#1
|
|||
|
|||
highlight replacement format where is mistake
Sub boltitalic()
Dim objDoc As Document Dim cboltitalic As Style Set objDoc = ActiveDocument Set cboltitalic = ActiveDocument.Styles.Add("*boltitalic", Type:=WdStyleType.wdStyleTypeCharacter) Options.DefaultHighlightColorIndex = wdYellow Selection.Find.ClearFormatting With cboltitalic.Font .Name = "Times New Roman" .Bold = True .Italic = True .Subscript = False .Superscript = False End With Dim rngStory As Range For Each rngStory In ActiveDocument.StoryRanges Application.ScreenUpdating = False With ActiveDocument.Range With rngStory.Find .ClearFormatting .Replacement.ClearFormatting .text = "[!+\-\<\>]" .Replacement.text = "" .MatchWildcards = True .Format = True .Forward = True .Wrap = wdFindContinue .Font.Bold = True .Font.Italic = True .Font.Subscript = False .Font.Superscript = False .Replacement.Style = "*boltitalic" Selection.Find.Replacement.ClearFormatting Selection.Find.Replacement.Highlight = True .Execute Replace:=wdReplaceAll End With End With Next rngStory Application.ScreenUpdating = True End Sub |
#2
|
||||
|
||||
Is there a question here?
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
thanks mayor
I found the solution.
Sub boltitalic() Dim objDoc As Document Dim cboltitalic As Style Set objDoc = ActiveDocument Set cboltitalic = ActiveDocument.Styles.Add("*boltitalic", Type:=WdStyleType.wdStyleTypeCharacter) With cboltitalic.Font .Name = "Times New Roman" .Bold = True .Italic = True .Subscript = False .Superscript = False End With Dim rngStory As Range For Each rngStory In ActiveDocument.StoryRanges Application.ScreenUpdating = False With ActiveDocument.Range With rngStory.Find Options.DefaultHighlightColorIndex = wdYellow .ClearFormatting .Replacement.ClearFormatting .text = "" .Replacement.text = "" .MatchWildcards = True .Format = True .Forward = True .Wrap = wdFindContinue .Font.Bold = True .Font.Italic = True .Font.Subscript = False .Font.Superscript = False .Replacement.Style = "*boltitalic" .Replacement.Highlight = True .Execute Replace:=wdReplaceAll End With End With Next rngStory Application.ScreenUpdating = True End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
I've set up sync with iCloud by mistake | brissle | Outlook | 0 | 12-13-2014 01:02 PM |
Huge Mistake! | markg2 | Excel | 2 | 05-12-2014 08:05 AM |
Made a mistake with a macro change | lance_kidd | Word | 0 | 02-09-2011 06:36 PM |
Initial Mistake | simpson55 | Outlook | 2 | 02-02-2011 09:52 AM |
find - reading highlight - highlight all / highlight doesn't stick when saved | bobk544 | Word | 3 | 04-15-2009 03:31 PM |