The following macro adds a series of tags (bold = <b></b>, italic = <i></i> & underlined = <u></u> - you can change that) to the bold, italic & underlined text in a document, and removes the bold, italic & underlined formatting at the same time.
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.Format = True
.Text = ""
.Font.Bold = True
.Replacement.Text = "<b>^&</b>"
.Replacement.Font.Bold = False
.Execute Replace:=wdReplaceAll
.ClearFormatting
.Font.Italic = True
.Replacement.Text = "<i>^&</i>"
.Replacement.Font.Italic = False
.Execute Replace:=wdReplaceAll
.ClearFormatting
.Font.Underline = True
.Replacement.Text = "<u>^&</u>"
.Replacement.Font.Underline = False
.Execute Replace:=wdReplaceAll
End With
End With
Application.ScreenUpdating = True
End Sub
If you comment-out the three '.Replacement.Font' lines ending in 'False', the formatting will be retained.