View Single Post
 
Old 04-01-2018, 01:53 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

A wildcard Find/Replace macro to do the conversion might be coded along the lines of:
Code:
Sub DemoI()
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.Text = "\1"
    .Format = False
    .Forward = True
    .Wrap = wdFindContinue
    .MatchWildcards = True
    .Replacement.ClearFormatting
    .Text = "\[b\](*)\[/b\]"
    .Replacement.Font.Bold = True
    .Execute Replace:=wdReplaceAll
    .Replacement.ClearFormatting
    .Text = "\[i\](*)\[/i\]"
    .Replacement.Font.Italic = True
    .Execute Replace:=wdReplaceAll
    .Replacement.ClearFormatting
    .Text = "\[u\](*)\[/u\]"
    .Replacement.Font.Underline = True
    .Execute Replace:=wdReplaceAll
    .Replacement.ClearFormatting
    .Text = "\[color=blue\](*)\[/color\]"
    .Replacement.Font.ColorIndex = wdBlue
    .Execute Replace:=wdReplaceAll
    .Text = "\[color=red\](*)\[/color\]"
    .Replacement.Font.ColorIndex = wdRed
    .Execute Replace:=wdReplaceAll
    .Text = "\[color=green\](*)\[/color\]"
    .Replacement.Font.ColorIndex = wdGreen
    .Execute Replace:=wdReplaceAll
  End With
End With
Application.ScreenUpdating = True
End Sub
The above macro handles bold, italics, underline, plus red, green & blue text. You could extend it to handle more formats.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote