I read with great interest the Browsing (VBA/Excel) topic because I, too, have been looking for code similar to what was
suggested for Excel, but for Word 2003. Word doesn't seem to have a similar option (but then I've missed the obvious before
What I'm trying to do is modify the code provided in Andrew Savikas' Word Hacks for Find/Replace in Multiple
Files (Hack #31) in several ways to make it more useful for myself and my editors.
My goal is to have a
three-part macro. (1) Part 1 allows the editor to identify the files or the folder and keep that location information until
this particular part of the macro is run again, which would automatically clear out the information, or until Word is exited,
at which time the information would be removed from the macro. This identification needs to be via a dialog box, similar to
the File Open box. In the hack the path is hardwired into the macro, requiring the macro to be edited each time it is used as
.LookIn = "C:My Documents"
.SearchSubFolders = False
(2) Part 2 is the F&R in Multiple Files part, drawing the location information for
the files/folder on which to run macro on from Part 1. Which raises the second problem with the hack -- the F&R text are also
hardwired into the macro as follows:
Set rng = doc.Range
.Text = "Dewey & Cheatem"
.Replacement.Text = "Dewey, Cheatham & Howe"
I need to create an interactive way for my editors to
enter the Find text and the Replacement text so that this part of the macro can be used and reused repeatedly for different
(3) Part 3: Not included in the hack, but something else that I am trying to include, is the creation a
record of the text entered as the Find and as the Replacement in a separate Word document along with a corresponding list of
the files (not the folder where the files were located when the F&R was run) on which the F&R was run in alphabetical order
by the Find entry.
Here's what I'm trying to accomplish: We usually work on book manuscripts that run 75 to 300
chapters (1 chapter to a file). The chapters rarely all arrive together, usually arrive out of sequence, and are written by
different authors. Part of our job is to make usage consistent (for example, that an acronym's meaning is the same in each
chapter, such as CT always means computerized tomography and not sometimes computed tomography). Part 1 of the macro would
allow the editor to easily identify where the other chapters to be searched are located. Part 2 would allow her, using the CT
example, to search for every instance of CT in the chapters conform each instance to computerized tomography. Part 3, by
creating the separate document, would allow her to (a) make the same F&R on additional chapters as she was assigned them,
([img]/forums/images/smilies/cool.gif[/img] tell her on which chapters she already had done the particular search on, and ©
provide a way for other editors who are working on the same project but different chapters to make the same F&R on their
The most crucial parts are 1 and 2; part 3 would be nice but if I can get the macro to work with just
parts 1 and 2, I would consider that a success. Any help on any one or more of the parts is appreciated. Thanks.