P
PrincessKitty
I need a code that will look for an italicized word and highlight it and pop
up a message box asking the user if they want to remove the italics. The
user clicks yes, no, or cancel and the code highlights the next italicized
word and pops up the msgbox again. This needs to happen till it reaches the
end of the document.
This is what I have so far.
Sub Macro3()
Dim myVariable As Integer
' Macro2 Macro
' Macro recorded 11/29/2005 by ep654c
'
With Selection.Find
.Execute
.ClearFormatting
.Font.Italic = True
.Format = True
.Replacement.ClearFormatting
.Replacement.Font.Italic = False
myVariable = MsgBox("Do you want to remove italics?", vbQuestion +
vbYesNoCancel, "Remove Italics?")
If myVariable = 6 Then
.Execute Forward:=True, Replace:=wdReplaceOne, _
Format:=True, ReplaceWith:=""
ElseIf myVariable = 7 Then
.Execute Forward:=False
ElseIf myVariable = 2 Then
.Execute Forward:=False
End If
End With
End Sub
Please help. Thank you!
up a message box asking the user if they want to remove the italics. The
user clicks yes, no, or cancel and the code highlights the next italicized
word and pops up the msgbox again. This needs to happen till it reaches the
end of the document.
This is what I have so far.
Sub Macro3()
Dim myVariable As Integer
' Macro2 Macro
' Macro recorded 11/29/2005 by ep654c
'
With Selection.Find
.Execute
.ClearFormatting
.Font.Italic = True
.Format = True
.Replacement.ClearFormatting
.Replacement.Font.Italic = False
myVariable = MsgBox("Do you want to remove italics?", vbQuestion +
vbYesNoCancel, "Remove Italics?")
If myVariable = 6 Then
.Execute Forward:=True, Replace:=wdReplaceOne, _
Format:=True, ReplaceWith:=""
ElseIf myVariable = 7 Then
.Execute Forward:=False
ElseIf myVariable = 2 Then
.Execute Forward:=False
End If
End With
End Sub
Please help. Thank you!