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.