C
Charles Belov
I have the following code in which I am trying to replace italic formatting
in both the body text and headers/footers with bold:
Sub CleanUpItalics()
'
' CleanUpItalics Macro
' Macro recorded 11/14/2008 by cbelov
'
Call subCleanUpItalics
If ActiveWindow.Panes.Count > 1 Then
ActiveWindow.Panes(2).Activate
Call subCleanUpItalics
ActiveWindow.ActivePane.Close
End If
End Sub
Sub subCleanUpItalics()
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.ClearFormatting
.Text = "*"
.Font.Italic = True
.Replacement.Text = "^&"
.Replacement.Font.Italic = False
.Replacement.Font.Bold = True
.Execute Replace:=wdReplaceAll
.MatchWildcards = True
End With
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
End Sub
It accomplishes nothing.
How do I accomplish this replacement in a macro?
If I use <*> as the wildcard string the replacement happens, but that only
replaces the formatting for individual words. The space between them remains
italic. I'd like a clean document so that if I insert text within the
formerly italic area, the text will be bold, not italic regardless of where
I click.
<*> also doesn't work in the headers and footers (for the macro as coded
above).
Charles Belov
SFMTA
http://www.sfmta.com/webmaster
in both the body text and headers/footers with bold:
Sub CleanUpItalics()
'
' CleanUpItalics Macro
' Macro recorded 11/14/2008 by cbelov
'
Call subCleanUpItalics
If ActiveWindow.Panes.Count > 1 Then
ActiveWindow.Panes(2).Activate
Call subCleanUpItalics
ActiveWindow.ActivePane.Close
End If
End Sub
Sub subCleanUpItalics()
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.ClearFormatting
.Text = "*"
.Font.Italic = True
.Replacement.Text = "^&"
.Replacement.Font.Italic = False
.Replacement.Font.Bold = True
.Execute Replace:=wdReplaceAll
.MatchWildcards = True
End With
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
End Sub
It accomplishes nothing.
How do I accomplish this replacement in a macro?
If I use <*> as the wildcard string the replacement happens, but that only
replaces the formatting for individual words. The space between them remains
italic. I'd like a clean document so that if I insert text within the
formerly italic area, the text will be bold, not italic regardless of where
I click.
<*> also doesn't work in the headers and footers (for the macro as coded
above).
Charles Belov
SFMTA
http://www.sfmta.com/webmaster