R
Rees
I need the simplest macro in the world -- to do a Find of the next instance
of Heading 1 (any character). The following, which was generated by
keystrokes and not edited, will not work. The search either does not take
place or it is unsuccessful. Can you see what might be wrong with this
code? Thanks.
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Heading 1")
Selection.Find.ParagraphFormat.Borders.Shadow = False
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
of Heading 1 (any character). The following, which was generated by
keystrokes and not edited, will not work. The search either does not take
place or it is unsuccessful. Can you see what might be wrong with this
code? Thanks.
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Heading 1")
Selection.Find.ParagraphFormat.Borders.Shadow = False
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1