Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

Loop/ repeat a macro through whole document

$
0
0

Greetings,

I got a little side project of sorting through some really long Word documents (doing it manually is not an option) and then mining the relevant data and moving it in an organized way into a table/ excell where it could be sorted in different ways.

the data i have is luckily almost always organized in chunks that are 1 sentence long, and start with the same key-words that I can search.

what I would like to do is basically: 1. search the whole document for a specific keyword (fx: 'year') 2. select the keyword 3. expand the selection to the whole sentence, or expand the selection until a different keyword. 4. then i could copy-paste a huge chunk of info into fx. one column with relatively few errors that I will need to manually correct - and then move on to different keywords.

It should be really simple I think, but using the following stops after highlighting 1 sentence:

Sub Makro1()

With Selection
.Expand Unit:=wdSentence
End With

End Sub


any nudge in the right direction would be appreciated!


Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>