A
andreas
Dear Experts:
below macro executes a font reset on paragraphs formatted with built-
in heading 1 style. It works fine (i.e. it clears manually formatting)
with the exception of the following cases:
If the paragraph (formatted with the built-in heading 1 style) has
subsequently been applied a user-defined character style, the macro
does not reset these applied character styles. How do I have to change
the code so that it also clears these character styles?
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub RmvManFoHead1()
Dim para As Word.Paragraph
Dim rng As Word.range
For Each para In ActiveDocument.Paragraphs
If para.range.Style = ActiveDocument.Styles(wdStyleHeading1)
Then
Set rng = para.range
rng.StartOf Unit:=wdParagraph
With rng
.MoveEndUntil Cset:=vbCrLf, count:=wdForward
.MoveEnd Unit:=wdCharacter, count:=1
End With
rng.Select
rng.Font.Reset
End If
Next para
End Sub
below macro executes a font reset on paragraphs formatted with built-
in heading 1 style. It works fine (i.e. it clears manually formatting)
with the exception of the following cases:
If the paragraph (formatted with the built-in heading 1 style) has
subsequently been applied a user-defined character style, the macro
does not reset these applied character styles. How do I have to change
the code so that it also clears these character styles?
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub RmvManFoHead1()
Dim para As Word.Paragraph
Dim rng As Word.range
For Each para In ActiveDocument.Paragraphs
If para.range.Style = ActiveDocument.Styles(wdStyleHeading1)
Then
Set rng = para.range
rng.StartOf Unit:=wdParagraph
With rng
.MoveEndUntil Cset:=vbCrLf, count:=wdForward
.MoveEnd Unit:=wdCharacter, count:=1
End With
rng.Select
rng.Font.Reset
End If
Next para
End Sub