Batch font attribute find and replace

A

April

Does anyone have recommendations for how to batch convert existing DOC files
that have font attributes that I want to see changed? For instance, let's
say I have 30 DOC files in a folder, and I want to change the font face
"Arial" with "Times Roman" in ALL of the DOCs. Is there a tool that will do
the conversion in a batch process as opposed to having to open each DOC file
and perform alot of editing within the DOC? Likewise, the tool would have
to change the font height, from let's say wherever a font 12 is found to
font size 10.
 
J

Jay Freedman

Does anyone have recommendations for how to batch convert existing DOC files
that have font attributes that I want to see changed? For instance, let's
say I have 30 DOC files in a folder, and I want to change the font face
"Arial" with "Times Roman" in ALL of the DOCs. Is there a tool that will do
the conversion in a batch process as opposed to having to open each DOC file
and perform alot of editing within the DOC? Likewise, the tool would have
to change the font height, from let's say wherever a font 12 is found to
font size 10.

You can use the macro in
http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm (and if needed
read http://www.gmayor.com/installing_macro.htm).

When the macro shows the Replace dialog, leave both the Find What and
Replace With boxes empty. Click the More button to expand the dialog.
With the cursor in the Find What box, click the Format button and
choose Font, select Arial and 12 pt, and click OK. Move the cursor to
the Replace With box, click Format > Font again, choose Times Roman
and 10 pt, and click OK. The labels below the two boxes in the Replace
dialog should now show the two formats. Click the Replace All button.
The macro will ask whether to change all the documents, and you can
continue or stop there.

Depending on what you're trying to achieve, you may need to run the
macro several times. What I just described will specifically change
only text that was Arial 12 pt -- it would ignore Arial text of any
other size, and it would ignore 12 pt text in any other font. So you
may have to run the macro again and choose Arial but leave the size
unspecified; and you may have to run it a third time and choose 12 pt
while leaving the font unspecified.
 
A

April

You can use the macro in

Jay,

Thanks, but...

It is very unclear WHERE one should input the macro. Yes, I know about the
Macro IDE/VB editor, but a macro has to be saved in a file of some sort.

The help link you sent me to makes refere to a 'global template' and
something about a normal.dot template, but nowhere is there a normal.dot
file on my hard drive, leaving me guessing as to what DOC/DOT to open before
going into the Macro IDE.

It would be helpful to know where I can find the resulting saved macro, so
that I can also back it up.
 
D

Doug Robbins - Word MVP

Press Alt+F11 to display the Visual Basic Editor. You will see Normal
listed in the Project window. If there is a Modules folder in the folder
tree, open that and select one of the modules and then paste the code into
right hand window.

If there is no Modules folder, select Module from the Insert menu of the
Visual Basic Editor and insert one.

OR

In Word, from the Tools menu, select Macro and then Macros. In the Macros
dialog that appears, fromthe Macros In pulldown, select Normal.dot (global
template) and then enter a name for the macro in the Macro name control and
then click on Create. That will cause the Visual basic editor to open and
you can then paste the code into the visual basic editor. Make sure that
you do not paste the code from the website, including the Sub [macroname]
and End Sub, inside the Sub [macroname] and End Sub of the codeless macro
that was created when you clicked on the Create button.

If you are using Word 2007, to display the Macros dialog, select Macros from
the Code section of the Developer tab.

Or in all versions, use Alt+F8

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
A

April

Hope this helps.

Yes, it does. Thanks. The only question left unanswered is: where I can
find the resulting saved macro, so
that I can also back it up?
 
J

Jay Freedman

Yes, it does. Thanks. The only question left unanswered is: where I can
find the resulting saved macro, so
that I can also back it up?

If you followed Doug's directions to put the macro in a module under
"Normal" in the VBA editor, then the macro is stored in the Normal.dot
template (Normal.dotm for Word 2007). That's stored in the Templates
folder indicated in the File Locations tab of the Options dialog. By
default it's the folder %appdata%\Microsoft\Templates.
 
M

macropod

Hi April,

If your documents are properly configured through the use of Word's paragraph styles, you will only need to update the style
definitions for each document, rather than changing each paragraph.

Cheers
 

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