Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Display Word Paragraphs in Excel???
There are multiple Word documents that get updated. I need a method to allow
a user to instantly (or as quickly as possible) display the first 3 paragraphs from any particular Word document in Excel. For example, in Excel user clicks "Planning Services"; then the first 3 paragraphs in the Word document "Planning Services.doc" is displayed for the user. The user only needs to read the info, not do anything else with it. The paragraphs are relatively short, but I'm not sure they would fit into a MsgBox. On the other hand, I would like to avoid the hassle of developing a user form if possible. There will be many copies of the Excel file distributed to many users on the network. Any suggestions? Thanks much in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Display Word Paragraphs in Excel???
quartz
A message box holds approximately 1024 characters. If your text is less than that, you should be okay. Here's the basics of how to do it Sub ShowParagraphs() Dim wdApp As Word.Application Dim wdDoc As Word.Document Dim sPara As String Dim sFileName As String Dim i As Long sFileName = "C:\Dick\Ng\01 Jan\Planning Services.doc" Set wdApp = New Word.Application Set wdDoc = wdApp.Documents.Open(sFileName) For i = 1 To 3 sPara = sPara & wdDoc.Paragraphs(i).Range.Text Next i wdDoc.Close False wdApp.Quit MsgBox sPara End Sub This is by no means instant, or even fast. You can make it faster, however, depending on how many times it will run and some other factors. -- Dick Kusleika Excel MVP Daily Dose of Excel www.dicks-blog.com quartz wrote: There are multiple Word documents that get updated. I need a method to allow a user to instantly (or as quickly as possible) display the first 3 paragraphs from any particular Word document in Excel. For example, in Excel user clicks "Planning Services"; then the first 3 paragraphs in the Word document "Planning Services.doc" is displayed for the user. The user only needs to read the info, not do anything else with it. The paragraphs are relatively short, but I'm not sure they would fit into a MsgBox. On the other hand, I would like to avoid the hassle of developing a user form if possible. There will be many copies of the Excel file distributed to many users on the network. Any suggestions? Thanks much in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Display Word Paragraphs in Excel???
Dick,
Thanks so much, this is very helpful. "Dick Kusleika" wrote: quartz A message box holds approximately 1024 characters. If your text is less than that, you should be okay. Here's the basics of how to do it Sub ShowParagraphs() Dim wdApp As Word.Application Dim wdDoc As Word.Document Dim sPara As String Dim sFileName As String Dim i As Long sFileName = "C:\Dick\Ng\01 Jan\Planning Services.doc" Set wdApp = New Word.Application Set wdDoc = wdApp.Documents.Open(sFileName) For i = 1 To 3 sPara = sPara & wdDoc.Paragraphs(i).Range.Text Next i wdDoc.Close False wdApp.Quit MsgBox sPara End Sub This is by no means instant, or even fast. You can make it faster, however, depending on how many times it will run and some other factors. -- Dick Kusleika Excel MVP Daily Dose of Excel www.dicks-blog.com quartz wrote: There are multiple Word documents that get updated. I need a method to allow a user to instantly (or as quickly as possible) display the first 3 paragraphs from any particular Word document in Excel. For example, in Excel user clicks "Planning Services"; then the first 3 paragraphs in the Word document "Planning Services.doc" is displayed for the user. The user only needs to read the info, not do anything else with it. The paragraphs are relatively short, but I'm not sure they would fit into a MsgBox. On the other hand, I would like to avoid the hassle of developing a user form if possible. There will be many copies of the Excel file distributed to many users on the network. Any suggestions? Thanks much in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How Do I Replace Paragraphs With New Paragraphs In Excel? | Excel Discussion (Misc queries) | |||
how to format large word paragraphs into an excel file | Excel Worksheet Functions | |||
How can I enter multiple paragraphs in a single Excel cell? | Excel Discussion (Misc queries) | |||
Moving paragraphs from MS Word to Excel | Excel Discussion (Misc queries) | |||
Find paragraphs in word and export to Excel | Excel Programming |