View Single Post
 
Old 05-24-2009, 03:24 AM
Bahir Barak Bahir Barak is offline Windows XP Office 2003
Novice
 
Join Date: May 2009
Posts: 11
Bahir Barak is on a distinguished road
Default

OK , but when I done these changings in code and run the macro it gives this error :
((
Run-time error ,5560:
The Find What text contains a Pattern Match expression which is not valid.
))

The code after the changes become like below , and picture of the error message is in attachments .
waiting for u ......

thanks

Code:
Sub Find_and_Font()
'
' Code written by Bird_FAT
' This script uses the wildcard '*' to look for text between
' two other characters, then changes the font of the text.
' The While/Wend statement at the end causes it to
' loop until it reaches the end of the document.
'
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "("
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    While Selection.Find.Execute
    Selection.Font.Italic = wdToggle
    Selection.Font.Color = wdColorRed
    Wend
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = ")"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    While Selection.Find.Execute
    Selection.Font.Italic = wdToggle
    Selection.Font.Color = wdColorRed
    Wend
End Sub
Attached Images
File Type: jpg error.JPG (12.0 KB, 18 views)
Reply With Quote