jamespope
06-12-2006, 06:16 AM
Hello everyone,
Sorry for what will probably be a very basic query and thanks for taking the time to look at it.
I'm trying to get my macro to highlight 'resigns' (and variants) and 'appoints' (and variants) in different colours. I've come up with this:
' highlighting appointment
Selection.Find.ClearFormatting
Selection.Range.HighlightColorIndex = wdYellow
Selection.Find.Replacement.Highlight = True
With Selection.Find
.Text = "<[Aa]ppoin[a-z]@>"
.Replacement.Text = Text
.Replacement.Font.Bold = False
.Replacement.Font.Color = wdColorBlack
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
' highlighting resignation
Selection.Find.ClearFormatting
Selection.Range.HighlightColorIndex = wdViolet
Selection.Find.Replacement.Highlight = True
With Selection.Find
.Text = "<[Rr]esig[a-z]@>"
.Replacement.Text = Text
.Replacement.Font.Bold = False
.Replacement.Font.Color = wdColorBlack
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
---
but this doesn't seem to change the highlight colour at all :doh:
i'm probably using the wrong command but that's all i could see after messing around with some macro recordings.
any pointers very welcome!
Cheers,:beerchug:
James
Sorry for what will probably be a very basic query and thanks for taking the time to look at it.
I'm trying to get my macro to highlight 'resigns' (and variants) and 'appoints' (and variants) in different colours. I've come up with this:
' highlighting appointment
Selection.Find.ClearFormatting
Selection.Range.HighlightColorIndex = wdYellow
Selection.Find.Replacement.Highlight = True
With Selection.Find
.Text = "<[Aa]ppoin[a-z]@>"
.Replacement.Text = Text
.Replacement.Font.Bold = False
.Replacement.Font.Color = wdColorBlack
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
' highlighting resignation
Selection.Find.ClearFormatting
Selection.Range.HighlightColorIndex = wdViolet
Selection.Find.Replacement.Highlight = True
With Selection.Find
.Text = "<[Rr]esig[a-z]@>"
.Replacement.Text = Text
.Replacement.Font.Bold = False
.Replacement.Font.Color = wdColorBlack
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
---
but this doesn't seem to change the highlight colour at all :doh:
i'm probably using the wrong command but that's all i could see after messing around with some macro recordings.
any pointers very welcome!
Cheers,:beerchug:
James