title: Navigation Pane in Word 2016: VBA code to force collapsed view of headings
body: <p>I am trying to write a VBA macro that runs when opening a .docx document. I want it to force the display of the Navigation Pane and then force all of the headings (any level) to display in collapsed mode. I am trying to get the code for the Collapse command using the macro recorder.</p>
  
  <p>All I have when I record the macro is:</p>
  
  <pre><code>ActiveWindow.DocumentMap = True
  </code></pre>
  
  <p>Right-clicking on a heading in the Navigation Pane and collapsing does not record a code line. Is there a VBA method for this event?</p>