title: Microsoft Word macro to alter heading styles
body: <p>I am attempting to create a macro in Word that alters the style of a set of ~150 unique headings. All styles must be identical. My current code works and changes the formatting correctly, but only one heading at a time. 
  Simply put, it's ugly. </p>
  
  <p>I'm looking for something I can reuse, and possibly apply to more projects in the future. </p>
  
  <p>Maybe using the <code>loop</code> command? I don't know, I'm still somewhat new using VBA.</p>
  
  <pre><code>Sub QOS_Headings()
  Dim objDoc As Document
  Dim head1 As Style, head2 As Style, head3 As Style, head4 As Style
      Set objDoc = ActiveDocument
      Set head1 = ActiveDocument.Styles("Heading 1")
      Set head2 = ActiveDocument.Styles("Heading 2")
  
  With objDoc.Content.Find
      .ClearFormatting
      .Text = "Section A.^p"
      With .Replacement
      .ClearFormatting
      .Style = head1
      End With
      .Execute Wrap:=wdFindContinue, Format:=True, Replace:=wdReplaceOne
  End With
  End With
  End Sub
  </code></pre>