B
Batailleye
Hello,
I'm trying to write a macro that finds all italics in a document and
then inserts text before and after the italics. The problem I have is
that my macro (see below) does not find all the italicized text in a
document.
Sub FindItalics()
Dim myParagraph As paragraph
For Each myParagraph In ActiveDocument.Paragraphs
With myParagraph.Range.Find
.ClearFormatting
.Font.Italic = True
.Execute
If .Found = True Then
.Parent.InsertBefore ("<em>")
.Parent.InsertAfter ("</em>")
End If
End With
Next
End Sub
I'm trying to write a macro that finds all italics in a document and
then inserts text before and after the italics. The problem I have is
that my macro (see below) does not find all the italicized text in a
document.
Sub FindItalics()
Dim myParagraph As paragraph
For Each myParagraph In ActiveDocument.Paragraphs
With myParagraph.Range.Find
.ClearFormatting
.Font.Italic = True
.Execute
If .Found = True Then
.Parent.InsertBefore ("<em>")
.Parent.InsertAfter ("</em>")
End If
End With
Next
End Sub