LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Find text in a word document

Here is the excel portion of the code.

Sub GetParagraphs()

Set WordList = Sheets("Sheet1").Range("A1:A100")
Set ParagraphTitle = Sheets("Sheet2")

filetoOpen = Application _
.GetOpenFilename("Word Files (*.doc), *.doc")
If filetoOpen = False Then
MsgBox ("Cannot Open File - Exiting Macro")
Exit Sub
End If

Set WordObj = GetObject(pathname:=filetoOpen)
WordObj.Application.Visible = True

ParRowCount = 1
For Each Word In WordList
'Enter Word Search code here
'ParTitle = "text found in word"
ParagraphTitle.Range("A" & ParRowCount) = ParTitle
ParRowCount = ParRowCount + 1
Next Word

WordObj.Application.Quit
End Sub


"DR Bellavance" wrote:

Thanks for the reply Joel. I was afraid you were going to say that but I
didn't want to post to the "Word" discussion group until the "Excel" group
had a shot at it. I am posting this query to the "Word" group under the same
heading should anyone be interested in the response.
--
DR Bellavance


"Joel" wrote:

Go to the Word Macro webpage. Moving around in the wrod document isn't
simple and it would be better to get help with the word experts.. you c an
still running the macro in excel. You need to create a wordobject in excel
using either GetObject or or Createobject and then open the word document

set Wordobj = GetObject(filename:="c:\temp\word.doc") ' put this in excel

Then reference the macro that you get from the word experts using WordObj in
front of the word macro commands.

"DR Bellavance" wrote:

I have an Excel workbook with a range of cells that contain some text. I
need to find all instances of the text in a seperate Word document then, in
an adjacent cell on the Excel workbook, paste all the paragraph headers where
the text was found in the word document. Can anyone give me a clue??? I am
using Excel 2007 on a Windows XP Pro system.
--
DR Bellavance

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attach Word document to a text box in Excel Ahmed Habib[_2_] Excel Discussion (Misc queries) 1 July 15th 09 03:13 PM
Attach Word document to a text box in Excel Ahmed Habib Excel Discussion (Misc queries) 1 July 14th 09 07:58 PM
where do i find word document darlingdiaz New Users to Excel 3 January 24th 07 04:33 AM
The last column in my word document contains both text and number Ishta Excel Worksheet Functions 2 December 12th 05 07:00 PM
Exporting text to a Word document Ian M[_2_] Excel Programming 1 May 3rd 04 04:25 AM


All times are GMT +1. The time now is 11:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"