View Single Post
 
Old 05-28-2014, 09:05 PM
McBanjo McBanjo is offline Windows 7 64bit Office 2013
Novice
 
Join Date: May 2014
Posts: 6
McBanjo is on a distinguished road
Question Macro for changing formatting of certain parts of a word

Hi Thread,

I have a really simple thing I want to do in Word 2013 Macros I'm sure, but having little knowledge of Macro scripting makes it difficult.

Here's the scenario. We have several products that have certain branding in a different font, two sizes larger than the standard Arial font and bolded. Easy enough, but the first few letters of the product name are also a different colour based on what product it is.

i.e. this:

abcphone
abcmobile
abcdesktop
abclaptop

to this:

abcphone
abcmobile
abcdesktop
abclatop


Here is something I've done so far:

Code:
Sub Branding()
'
' Branding Macro
'

   Selection.Find.ClearFormatting
   Selection.Find.Replacement.ClearFormatting
   With Selection.Find
        .Text = "abcphone"
        .Selection
        .Replacement.Text = ""
        .Replacement.Font.Bold = True
        .Replacement.Font.Name = "Myriad"
        .Forward = True
        .Wrap = wdFindContinue
        .MatchWholeWord = True
   End With
   Selection.Find.Execute Replace:=wdReplaceAll

End Sub
Any pointers on how to do this for every one of these words in a document? Any help would be greatly appreciated.
Reply With Quote