Re: A macro to extract any para that starts a specific word into another document



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.


salah.mahmud@xxxxxxxxx wrote:
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,

--
Message posted via http://www.officekb.com

.



Relevant Pages

  • Re: Create .DOC files from .DOT files automatically
    ... the program to exit if the files already exist in the target folder. ... and than gives an error message that the .doc files already exist. ... @echo off ... Do batch files still work from a command prompt or in Explorer ...
    (microsoft.public.windows.file_system)
  • Re: Creating a Large Document using Insert File Link
    ... you were right the outputted files are .doc files named for the ... files inserted by macros that feed the majority of the templates. ... file by date in a network folder. ... all of these individual files into one document w/ page numbers and common ...
    (microsoft.public.word.vba.general)
  • Re: Create .DOC files from .DOT files automatically
    ... than gives an error message that the .doc files already exist. ... us with a copy of the .dot and .doc docs in the target folder. ... @echo off ... Assuming that .doc files have the same format as .dot files ...
    (microsoft.public.windows.file_system)
  • Re: Batch checking validity of hyperlinks in Msoft files
    ... For .dot and doc files it would be relatively straightforward to create such a tool. ... Use the following article as the basis for looking through a folder of files, ... Instead of the Find & replace code, you would instead have code iterates through the Hyperlinks collection and creates a report. ... No MS Office program opens PDF files, and the way hyperlinks are implemented in PDF files is quite different from most other applications. ...
    (microsoft.public.word.vba.general)
  • RE: WMP 11 wont do many things
    ... continued my own searching into the problem and am still completely stumped. ... to add a folder and the folder i just added wasn't in my manually addded ... each time won't let me get passed the media sharing settings without hitting ... years in and still smarter than my EE friends. ...
    (microsoft.public.windowsmedia.player)