#1
|
|||
|
|||
Macro to Replace Fonts
Everyone,
Can someone direct me to how to create a macro to convert/replace fonts in a document. I have several documents that get sent to me as Word documents. I would like to have a macro that will change all the fonts in the document to fonts that we use for another product. For example, from "Times New Roman, 8pt, Bold" to "XTN08B" or from "Courier, 10pt, Italic" to "XCO10I". Do I need to have a table defined somewhere that has my from and to values? Then loop through the table with the from and to values going against the document replacing the font if it finds it? The product we use has special Fonts that we use, but they are all True Type Fonts. What would be the best way to accomplish this? Was told by the users, they used a macro in Word 2003 before to do this, but they lost the macro and the one I find they tell about, does not work like they want it to. I accepted the challenge to write one for them, but I need some guidance from more experienced people. Any assistance would be greatly appreciated. Thanx in advance. Jerry |
#2
|
||||
|
||||
Hi Jerry,
Providing the document is correctly formatted via the use of Styles, all you should need to do is to change the font used by the Styles. Simply overriding the Style definitions is a bad idea.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
We use a product called Documerge and we need to change the fonts to how they are defined in the metacode. Just trying to create a macro, that will convert the Windows Fonts to the Fonts that are used for Documerge.
It may be a bad idea, but that is the charter. Jerry |
#4
|
||||
|
||||
Hi Jerry,
It doesn't really matter how the document was created; what matters is whether that process observed the proper conventions for using Styles for formatting. If it did, then the solution rmains as I said in my previous post - simply change the font names in the Style definitions. You can, of course, use Find/Replace to simply replace all instances of one font with another. The macro recorder will create a fairly efficient macro for this. I'm not sure where the tables figure in this, though. If a particular font you're wanting to replace is only used in tables, no worry. If it's used outside the table as well and you want to replace only the fonts within the tables, then the macro recorder doesn't provide that level of control. Post back if this is the case.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with find and replace or query and replace | shabbaranks | Excel | 4 | 03-19-2011 08:38 AM |
Help with fonts and forms | Natebond008 | Word | 2 | 06-05-2010 12:38 PM |
Fonts List | kai1 | Word | 0 | 02-22-2010 04:16 PM |
Missing Fonts | cstorer44@aol.com | Word | 0 | 03-06-2009 01:28 PM |
Find and Replace Macro - A Better Way | Tribos | Word VBA | 0 | 10-08-2008 03:22 AM |