Dear friends,
Hi,
Please help me about these macros, that are found from http://www.vbaexpress.com/forum/show...haracter-style
Some of the text work good and some not woked. Please help me![]()
Private Const UNIQUECODE = "xyzzy" Sub MarkBold_ApplyStyle_ReplaceBold() 'mark the text With Selection.Range.Duplicate.Find .Format = True .Font.Bold = True .Font.italic = True .underline = wdsingleunderline .Replacement.text = UNIQUECODE & "B" & UNIQUECODE & "^&" & UNIQUECODE & "BE" & UNIQUECODE .Wrap = wdFindStop .Execute Replace:=wdReplaceAll End With 'apply the style Selection.Style = "Special" 'replace the formatting, using a wildcard search With Selection.Range.Duplicate.Find .text = UNIQUECODE & "B" & UNIQUECODE & "*" & UNIQUECODE & "BE" & UNIQUECODE .Replacement.Font.Bold = True .MatchWildcards = True .Execute Replace:=wdReplaceAll End With 'now remove the special codes With Selection.Range.Duplicate.Find .text = UNIQUECODE & "B" & UNIQUECODE .Replacement.text = "" .Execute Replace:=wdReplaceAll .text = UNIQUECODE & "BE" & UNIQUECODE .Replacement.text = "" .Execute Replace:=wdReplaceAll End With End Sub
Regards,
Imran
Bookmarks