changing the formatting of entire paragraphs is to change the style : Word Format « Word « VBA / Excel / Access / Word






changing the formatting of entire paragraphs is to change the style

 
Sub ChangeStyle()
    Dim wdApp As Word.Application
    Dim wdRng As Word.Range
    Dim count As Integer
    
    Set wdApp = GetObject(, "Word.Application")
    
    With wdApp.ActiveDocument
        For count = 1 To .Paragraphs.count
            Set wdRng = .Paragraphs(count).Range
            With wdRng
                If .Style = "NO" Then
                    .Style = "HA"
                End If
            End With
        Next count
    End With
    
    Set wdApp = Nothing
    Set wdRng = Nothing
End Sub

 








Related examples in the same category

1.Format a Range