S
Steved
Hello from Steved
The below I would like to add to ignore X
12 PRIMO CANERA X8171 X2646
If the above did not have X my macro is fine how can I tell please to ignore X
Yes my objective is only to Highlite 12 PRIMO CANERA
Thankyou
Sub Highliter()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[0-9 ]{1,}[A-Z ]{1,}"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[A-Z ]@>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
ActiveDocument.Save
Selection.Font.Color = wdColorRed
Options.DefaultHighlightColorIndex = wdYellow
Selection.Range.HighlightColorIndex = wdYellow
Selection.HomeKey Unit:=wdLine
End Sub
Sub RaceBegin()
WordBasic.PageSetupMargins Tab:=0, PaperSize:=1, TopMargin:="0.5", _
BottomMargin:="0", LeftMargin:="1.2", RightMargin:="0", Gutter:="0", _
PageWidth:="46.1", PageHeight:="23.3", Orientation:=1, FirstPage:=0, _
OtherPages:=0, VertAlign:=0, ApplyPropsTo:=4, FacingPages:=0, _
HeaderDistance:="0", FooterDistance:="0", SectionStart:=2, _
OddAndEvenPages:=0, DifferentFirstPage:=0, Endnotes:=0, LineNum:=0, _
CountBy:=0, TwoOnOne:=0, GutterPosition:=0, LayoutMode:=0,
DocFontName:= _
"", FirstPageOnLeft:=0, SectionType:=1, FolioPrint:=0,
ReverseFolio:=0, _
FolioPages:=1
Selection.WholeStory
Selection.Font.Size = 12
Selection.HomeKey Unit:=wdStory
ActiveDocument.SaveAs FileName:="Racebase.docx", FileFormat:= _
wdFormatXMLDocument, LockComments:=False, Password:="",
AddToRecentFiles _
:=True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts _
:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
ActiveDocument.Close
Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0
End Sub
The below I would like to add to ignore X
12 PRIMO CANERA X8171 X2646
If the above did not have X my macro is fine how can I tell please to ignore X
Yes my objective is only to Highlite 12 PRIMO CANERA
Thankyou
Sub Highliter()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[0-9 ]{1,}[A-Z ]{1,}"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[A-Z ]@>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
ActiveDocument.Save
Selection.Font.Color = wdColorRed
Options.DefaultHighlightColorIndex = wdYellow
Selection.Range.HighlightColorIndex = wdYellow
Selection.HomeKey Unit:=wdLine
End Sub
Sub RaceBegin()
WordBasic.PageSetupMargins Tab:=0, PaperSize:=1, TopMargin:="0.5", _
BottomMargin:="0", LeftMargin:="1.2", RightMargin:="0", Gutter:="0", _
PageWidth:="46.1", PageHeight:="23.3", Orientation:=1, FirstPage:=0, _
OtherPages:=0, VertAlign:=0, ApplyPropsTo:=4, FacingPages:=0, _
HeaderDistance:="0", FooterDistance:="0", SectionStart:=2, _
OddAndEvenPages:=0, DifferentFirstPage:=0, Endnotes:=0, LineNum:=0, _
CountBy:=0, TwoOnOne:=0, GutterPosition:=0, LayoutMode:=0,
DocFontName:= _
"", FirstPageOnLeft:=0, SectionType:=1, FolioPrint:=0,
ReverseFolio:=0, _
FolioPages:=1
Selection.WholeStory
Selection.Font.Size = 12
Selection.HomeKey Unit:=wdStory
ActiveDocument.SaveAs FileName:="Racebase.docx", FileFormat:= _
wdFormatXMLDocument, LockComments:=False, Password:="",
AddToRecentFiles _
:=True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts _
:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
ActiveDocument.Close
Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0
End Sub