A family of Microsoft word processing software products for creating web, email, and print documents.
This should do it:
Sub doiteverywhere()
Dim myStoryRange As Range
'First search the main document using the Selection
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
Selection.Find.Font.Italic = True
With Selection.Find
Do While .Execute(FindText:="", MatchWildcards:=False, Forward:=True, Wrap:=wdFindStop) = True
With Selection
.InsertBefore "<"
.InsertAfter ">"
.Collapse wdCollapseEnd
End With
Loop
End With
'Now search all other stories using Ranges
For Each myStoryRange In ActiveDocument.StoryRanges
If myStoryRange.StoryType <> wdMainTextStory Then
myStoryRange.Select
Selection.Collapse wdCollapseStart
With Selection.Find
Do While .Execute(FindText:="", MatchWildcards:=False, Forward:=True, Wrap:=wdFindStop) = True
With Selection '.Range
.InsertBefore "<"
.InsertAfter ">"
.Collapse wdCollapseEnd
End With
Loop
End With
Do While Not (myStoryRange.NextStoryRange Is Nothing)
Set myStoryRange = myStoryRange.NextStoryRange
myStoryRange.Select
Selection.Collapse wdCollapseStart
With Selection.Find
Do While .Execute(FindText:="", MatchWildcards:=False, Forward:=True, Wrap:=wdFindStop) = True
With Selection '.Range
.InsertBefore "<"
.InsertAfter ">"
.Collapse wdCollapseEnd
End With
Loop
End With
Loop
End If
Next myStoryRange
ActiveWindow.View = wdPrintView
Selection.HomeKey wdStory
End Sub