title: Changing styles in Word
body: <p>I am very new to programming, so forgive my ignorance.  </p>
  
  <p>I am trying to create specific headings in a document that does not have any or has different heading styles assigned.  What precedes the text in the headings are numbers.  The numbers are specific and essentially represent the content of the material below the heading and thus are not going to change.  I am looking for a way to run a macro that would reformat the numeric headings along with the text beside it.  This will aid in navigating through the document.  When I typed in the code, I got no errors, but the Headings are formatted with the "Heading 2" style only, even though multiple heading styles are used.  Any help in this area would be appreciated very much. The code is listed below:</p>
  
  <pre><code>Sub QOS_Headings()_
  
  '
  ' QOS_Headings Macro
  
  ' Converts section headings in eCTD to usable navigation headings in Word.
  
  '
  Selection.Find.Text = ("3.2")_
  
  Selection.Style = ActiveDocument.Styles("Heading 1")
  Selection.Find.Text = ("3.2.S")
  Selection.Style = ActiveDocument.Styles("Heading 2")
  Selection.Find.Text = ("3.2.S.1")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.S.2")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.S.3")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.S.4")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.S.4.1")
  Selection.Style = ActiveDocument.Styles("Heading 4")
  Selection.Find.Text = ("3.2.S.4.2")
  Selection.Style = ActiveDocument.Styles("Heading 4")
  Selection.Find.Text = ("3.2.S.4.3")
  Selection.Style = ActiveDocument.Styles("Heading 4")
  Selection.Find.Text = ("3.2.S.4.4")
  Selection.Style = ActiveDocument.Styles("Heading 4")
  Selection.Find.Text = ("3.2.S.4.5")
  Selection.Style = ActiveDocument.Styles("Heading 4")
  Selection.Find.Text = ("3.2.S.6")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.S.7")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.P")
  Selection.Style = ActiveDocument.Styles("Heading 2")
  Selection.Find.Text = ("3.2.P.1")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.P.2")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.P.3")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.P.4")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.P.5")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.P.5.1")
  Selection.Style = ActiveDocument.Styles("Heading 4")
  Selection.Find.Text = ("3.2.P.5.2")
  Selection.Style = ActiveDocument.Styles("Heading 4")
  Selection.Find.Text = ("3.2.P.5.3")
  Selection.Style = ActiveDocument.Styles("Heading 4")
  Selection.Find.Text = ("3.2.P.5.4")
  Selection.Style = ActiveDocument.Styles("Heading 4")
  Selection.Find.Text = ("3.2.P.5.5")
  Selection.Style = ActiveDocument.Styles("Heading 4")
  Selection.Find.Text = ("3.2.P.5.6")
  Selection.Style = ActiveDocument.Styles("Heading 4")
  Selection.Find.Text = ("3.2.P.6")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.P.7")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.P.8")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.A")
  Selection.Style = ActiveDocument.Styles("Heading 2")
  Selection.Find.Text = ("3.2.A.1")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.A.2")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.A.3")
  Selection.Style = ActiveDocument.Styles("Heading 3")
  Selection.Find.Text = ("3.2.R")
  Selection.Style = ActiveDocument.Styles("Heading 2")
  End Sub
  </code></pre>