IsStyleSeparator Property

Microsoft Word Visual Basic

expression.IsStyleSeparator

expression    Required. An expression that returns a Paragraph object.

Example

This example formats all paragraphs in which there is a style separator with the built-in "Normal" style.

Sub StyleSep()
    Dim pghDoc As Paragraph
    For Each pghDoc In ThisDocument.Paragraphs
        If pghDoc.IsStyleSeparator = True Then
            pghDoc.Range.Select
            Selection.Style = "Normal"
        End If
    Next pghDoc
End Sub
		

This example adds a paragraph after each style separator and then deletes the style separator.

Sub RemoveStyleSeparator()
    Dim pghDoc As Paragraph
    Dim styName As String

    'Loop through all paragraphs in document to check if it is a style
    'separator. If it is, delete it and enter a regular paragraph
    For Each pghDoc In ThisDocument.Paragraphs
        If pghDoc.IsStyleSeparator = True Then
            pghDoc.Range.Select
            With Selection
                .Collapse (wdCollapseEnd)
                .TypeParagraph
                .MoveLeft (1)
                .TypeBackspace
            End With
        End If
    Next pghDoc
End Sub