LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Return a line from Word doc after a Find

I need to return a line from a Word doc after using a Find operation. I'm searching for the first part of the line, but need to return the text after that. I can use the Report Generation Toolkit to do the Find operation OK, but I'm stuck after that. I don't know where the found line is. The Word.Find operation doesn't return a line number. Any ideas to nudge me a little further?

Thanks,
George
0 Kudos
Message 1 of 3
(2,419 Views)

Hi George,

      ActiveX may be the most direct route to grabbing this text - Michael Munroe describes using "find" here.  I also came across a Word/ActiveX example that uses the NIReport VI "Generate Report Get Data to Modify.vi" to obtain the Word .doc automation reference.   There's lots of examples on this site for ActiveX and Word (search: ActiveX Microsoft Word.)  Here's one.  Unfortunately, Word isn't installed on my PC or I might have tried to build something for you. Smiley Sad

 Cheers!

Message Edited by tbd on 06-01-2007 03:32 AM

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 3
(2,407 Views)

Thanks. I found the first reference before, but it doesn't really describe how to get text after the find. Fortunately I was able to figure it out after much guessing. Here's how it goes for anyone who's interested. After the Find I had to do a Frame->Select to select the found word. Next came ActiveWindow->Selection->Range->End to get the location of the end of the selection. Then I used that end location as the Start for Document->Range->Text to give me the text I was looking for.

George

Message 3 of 3
(2,396 Views)