A macro to extract any para that starts a specific word into anotherdocument

S

salah.mahmud

I'm looking for a Word macro that would search a list of documents
(all *.doc in a specific folder) for a specific word and extracts any
para that starts with that word into another document.

Any tips will be greatly appreciated,

Thanks,
 
F

fumei via OfficeKB.com

This is not terribly difficult to do. What have you tried so far? Please
post any code you have, and be explict about what problems you may be having.

Basically, you:

1. make a new blank document (Hint: use Document objects)
2. use the Dir function to process (open) all .doc in a folder
3. make a range object of each opened document
4. use the Find method of that range to find the specific word
5 expand the range (if Found), to be the whole paragraph
6. dump that at the end of the range of the new document

Note: you do NOT have to do a copy and paste in order to do this.

7. continue on until the end of the current document
8. close that document, and then open the next one - this is a function of
using Dir

Note: using Dir means opening ALL the .doc files in the folder and searching
the open document for the text.

There is another alternative, as long as you are NOT using Word 2007.
FileSearch is (or was) a very handy tool. It is no longer available as of
2007. You could use FileSearch to look into all the .doc files in a folder
for the search text, and then open ONLY the ones that actually have that text.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top