M
Mike
In our company, we have a number of older documents that used hidden
paragraph marks instead of style separators. The purpose of both is to
separate headings from body text for easier generation of TOC. I am finding
a number of documents that have a combination - hidden paragraphs marks &
style separators - and it gets confusing to view these documents when hidden
paragraph marks turned on (pagination will change). While my routine works,
I do not like the fact that hidden paragraph marks & style separators do not
appear to be distinguishable programatically; visually you can tell the
difference because style separators have a light dotted frame around them.
I was wondering if there is a way to distinguish the style separator from
other codes.
TIA,
Mike
Sub HiddenParaToStyleSep()
Selection.HomeKey Unit:=wdStory
' Find hidden paragraph
With Selection.Find
.ClearFormatting
.Text = "^p"
.Font.Hidden = True
.Forward = True
While .Execute
' Replace hidden paragraph with auto color, unhide
With Selection.Font
.Hidden = False
.Color = wdColorAutomatic
End With
' Insert style separator
Selection.InsertStyleSeparator
Wend
End With
End Sub
paragraph marks instead of style separators. The purpose of both is to
separate headings from body text for easier generation of TOC. I am finding
a number of documents that have a combination - hidden paragraphs marks &
style separators - and it gets confusing to view these documents when hidden
paragraph marks turned on (pagination will change). While my routine works,
I do not like the fact that hidden paragraph marks & style separators do not
appear to be distinguishable programatically; visually you can tell the
difference because style separators have a light dotted frame around them.
I was wondering if there is a way to distinguish the style separator from
other codes.
TIA,
Mike
Sub HiddenParaToStyleSep()
Selection.HomeKey Unit:=wdStory
' Find hidden paragraph
With Selection.Find
.ClearFormatting
.Text = "^p"
.Font.Hidden = True
.Forward = True
While .Execute
' Replace hidden paragraph with auto color, unhide
With Selection.Font
.Hidden = False
.Color = wdColorAutomatic
End With
' Insert style separator
Selection.InsertStyleSeparator
Wend
End With
End Sub