A
andreas
Dear Experts:
Below macro applies a user-defined character style to all words/
characters that have manually been formatted bold.
How can I make sure that the macro SKIPS paragraphs where the bold
formatting is part of the paragraph style. For example, this is the
case for all the built-in heading styles (wdStyleHeading1,2,3,4,5).
Help is much appreciated. Thank you very much in advance. Regards,
Andreas
Sub ApplyCharStyleToManuallyBold()
If MsgBox("Characters that have MANUALLY been formatted bold are
applied a user-defined character style." & _ vbCrLf & _
"Would you like to continue?", vbYesNo, "Formatierung der Kopfzeile
der Tabelle") = vbYes Then
Set rng = ActiveDocument.StoryRanges(wdMainTextStory)
With rng.Find
.ClearFormatting
.Replacement.ClearFormatting
.Font.Bold = True
.Replacement.Style = "Character_Style_Bold"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchWildcards = False
.Execute Replace:=wdReplaceAll
End With
End If
End Sub
Below macro applies a user-defined character style to all words/
characters that have manually been formatted bold.
How can I make sure that the macro SKIPS paragraphs where the bold
formatting is part of the paragraph style. For example, this is the
case for all the built-in heading styles (wdStyleHeading1,2,3,4,5).
Help is much appreciated. Thank you very much in advance. Regards,
Andreas
Sub ApplyCharStyleToManuallyBold()
If MsgBox("Characters that have MANUALLY been formatted bold are
applied a user-defined character style." & _ vbCrLf & _
"Would you like to continue?", vbYesNo, "Formatierung der Kopfzeile
der Tabelle") = vbYes Then
Set rng = ActiveDocument.StoryRanges(wdMainTextStory)
With rng.Find
.ClearFormatting
.Replacement.ClearFormatting
.Font.Bold = True
.Replacement.Style = "Character_Style_Bold"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchWildcards = False
.Execute Replace:=wdReplaceAll
End With
End If
End Sub