Thread: [Solved] Macro to loop in Word
View Single Post
 
Old 02-06-2012, 11:31 AM
Yamaha Rider Yamaha Rider is offline Windows XP Office 2007
Novice
 
Join Date: Feb 2012
Posts: 2
Yamaha Rider is on a distinguished road
Default Macro to loop in Word

I have the word document that I want to color a particular wird a certain way. Attached is a sample with the Macro that I wrote. I now need to loop this macro throughout the document so does this throughtout hte document. Can somebody help me?

Here is what I have
Code:
Selection.Find.ClearFormatting
With Selection.Find
  .Text = "gopost`"
  .Replacement.Text = ""
  .Forward = True
  .Wrap = wdFindContinue
  .Format = False
  .MatchCase = False
  .MatchWholeWord = False
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=2, Extend:=wdExtend
Selection.Font.color = wdColorRed
Selection.Font.Bold = wdToggle
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=4, Extend:=wdExtend
Selection.Font.color = 5296274
Selection.Font.Bold = wdToggle
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.color = wdColorRed
Selection.Font.Bold = wdToggle
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub
Attached Files
File Type: docx The brown dog GOPOST.docx (10.0 KB, 12 views)

Last edited by macropod; 02-06-2012 at 03:28 PM. Reason: Added Code Tags
Reply With Quote