Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
I have MS Word 2002. I am trying to create a macro with a search and replace
for Times New Roman size 12 to replace it with Courier New size 10. It works when creating the macro, but not when I run the macro. And there is no mention of either font in the VBA (edit). Any ideas? Thanks, brad |
#2
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Ok, I found a solution. When changing font and size of font in a macro,
don't use search and replace. Instead highlight area and use "Format" and then "Font" from the toolbar. "Brad in Tampa" wrote: I have MS Word 2002. I am trying to create a macro with a search and replace for Times New Roman size 12 to replace it with Courier New size 10. It works when creating the macro, but not when I run the macro. And there is no mention of either font in the VBA (edit). Any ideas? Thanks, brad |
#3
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
The macro recorder does not store the complete range of functions and often
produces rather bulky code. To add font information to a search, you will have to add it manually eg Sub ReplaceExample() With Selection .HomeKey Unit:=wdStory With .Find .ClearFormatting .Replacement.ClearFormatting '********************** .Text = "" .Font.Name = "Times New Roman" .Font.Size = "12" .Replacement.Text = "" .Replacement.Font.Name = "Courier New" .Replacement.Font.Size = "10" '********************** .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False .Execute Replace:=wdReplaceAll End With End With End Sub http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Brad in Tampa wrote: I have MS Word 2002. I am trying to create a macro with a search and replace for Times New Roman size 12 to replace it with Courier New size 10. It works when creating the macro, but not when I run the macro. And there is no mention of either font in the VBA (edit). Any ideas? Thanks, brad |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Search-and-replace macro never works | Microsoft Word Help | |||
Search and Replace | Microsoft Word Help | |||
search and replace macro genius? | Microsoft Word Help | |||
Search and Replace | Formatting Long Documents | |||
Search and Replace not working if I select a Format for Heading St | Microsoft Word Help |