L
LEU
I have the following macro that looks for a word in the document and replaces
it if it’s in a Heading style. The problem is it does not get all the words I
am looking for. How would I rewrite it to get all the words except if the
word is in a table, textbox or a graph?
Dim SearchRange As Range
Set SearchRange = ActiveDocument.Range
With SearchRange.Find
..Text = InputBox("Word to Bold and Cap:")
..MatchWholeWord = True
While .Execute
Select Case SearchRange.Style
Case "Heading 1", "Heading 2", "Heading 3", "Heading 4", "Heading 5",
"Heading 6", "Heading 7"
SearchRange.Font.AllCaps = True
SearchRange.Font.Bold = True
Case Else
'Do Nothing
End Select
Wend
End With
LEU
it if it’s in a Heading style. The problem is it does not get all the words I
am looking for. How would I rewrite it to get all the words except if the
word is in a table, textbox or a graph?
Dim SearchRange As Range
Set SearchRange = ActiveDocument.Range
With SearchRange.Find
..Text = InputBox("Word to Bold and Cap:")
..MatchWholeWord = True
While .Execute
Select Case SearchRange.Style
Case "Heading 1", "Heading 2", "Heading 3", "Heading 4", "Heading 5",
"Heading 6", "Heading 7"
SearchRange.Font.AllCaps = True
SearchRange.Font.Bold = True
Case Else
'Do Nothing
End Select
Wend
End With
LEU