I was hoping someone could help with a MS Word Macro.
Basically, I have a MS Word document which lists out several text files and specific pages of interest in each file.
The file format is similar to:
textdocument1.txt P. 6, 12 - issue1 textdocument2.txt P. 5 - issue1 P. 13, 17 - issue3 textdocument3.txt P. 10
I want to read each line into my Macro as a string.
Then traverse through it to identify the file name. With the file name, I can then open the file, go to the page number, and copy the data I need.
But I'm stuck at step 1, how do I capture the line into a string in an MS Word Macro?
Any help will be appreciated.
If your word document lists all the text files like this:
Then all the lines are available in the Paragraphs collection. You can loop through that with a simple
For Each
loop:The following code should get you started:
I found the basic algorithm in this article.
per line