Re: Help with Macro to Change Font Color

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi everybody,

like Tony said (good wildcard pattern):

Sub test0987()
Selection.HomeKey unit:=wdStory
Selection.ExtendMode = False
ResetSearch
With Selection.Find
.Text = "[! *]{1,}\*"
.MatchWildcards = True
.Replacement.Font.Color = wdColorBlue
.Execute replace:=wdReplaceAll
End With
ResetSearch
End Sub

Public Sub ResetSearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
.



Relevant Pages

  • Re: Code wont execute Main Macro Calls - non breaking spaces
    ... Public Sub MainMacro() ... Sub DoFindReplace(FindText As String, ReplaceText As String, ... My MAIN MACRO does not execute the first 2 options DO FIND AND REPLACE. ... .MatchWildcards = False ...
    (microsoft.public.word.vba.general)
  • Re: Using Case
    ... Sub Resetsearch() ... .MatchWildcards = False ... Dim sMsg1 As String ' String Message 1 ... .Execute Replace:=wdReplaceAll ...
    (microsoft.public.word.vba.general)
  • Re: Reconize 2 characters
    ... Dim rDcm As Range ... ResetSearch ... Public Sub ResetSearch() ... .MatchWildcards = False ...
    (microsoft.public.word.vba.general)
  • Re: Tech Eval
    ... > End Sub ... >> Dim TextChar As String ... >> .MatchWildcards = True ... >> .Execute Replace:=wdReplaceAll>> Next ...
    (microsoft.public.word.vba.general)
  • Re: How to extract strings from the code inside a field?
    ... Sub Resetsearch() ... .MatchWildcards = False ... While .Execute ...
    (microsoft.public.word.vba.general)