1

Is there any way to manipulate the content of MS-Word's Navigation Pane via VBA Macros. I found that I can get the navigation pane object via Application.CommandBars("Navigation") and manipulate its width or hide/unhide it, but what I am looking for is manipulation of the document outline ("Headings"), specifically folding/unfoloding specific items.

My specific use-case is to adjust which headings are folded and which are unfolded according to my general document structure, where the first 5 chapters contain general information (with many subchapters) that I hardly ever need to access. So I want to write a macro that folds those chapters while it opens other subsections which I frequently use.

Tried so far:

Sub CustomizeNavPane()
    Dim navpane As Object
    Set navpane = Application.CommandBars("Navigation")
    navpane.Width = navpane.Width - 20
End Sub

Expected: Getting a NavigationPane object with specific methods for the Navigation Pane as opposed to a generic CammandBar object with generic methods.

treuss
  • 1,913
  • 1
  • 15
  • 1
    I don't think that this is possible, see [Navigation Pane in Word 2016: VBA code to force collapsed view of headings](https://stackoverflow.com/questions/55885338/navigation-pane-in-word-2016-vba-code-to-force-collapsed-view-of-headings) – Ike Nov 09 '22 at 15:11
  • I already feared the same. Thanks for posting the link. – treuss Nov 09 '22 at 15:19

0 Answers0