MS Word

Make Outline View Open Expanded to a Specified Level

The Problem:

Word opens in Outline view with everything expanded, including the text. I only want it to show Level 1 headings.

The Solution:

Create the macro shown in Example 8-3 to replace Word's built-in ViewOutlineMaster command, which is used for the View » Outline command and for the Outline View button on the horizontal scrollbar.

Macro to make Outline view open expanded to Heading Level 1

Example 8-3
    Sub ViewOutlineMaster()
      ActiveWindow.View.Type = wdOutlineView
      ActiveWindow.View.ShowHeading (1)
    End Sub

The first statement changes the view of the active window to Outline view. The second statement collapses the outline so that it shows only Level 1 headings. Change the heading number if you want to display a different level of headingsfor example, ActiveWindow.View.ShowHeading (3) displays Level 1, Level 2, and Level 3 headings.

Copy and paste the macro in the same module you created in "Return to the Last Editing Position When Opening a Document," but change the name of the copy to "ViewOutline." This replaces the built-in Word command assigned to the Ctrl+Alt+O shortcut for switching to Outline view. (If you need to get the built-in Word command back, rename or delete your macro.)

Still in the Visual Basic Editor, click the Save button, or choose File » Save, to save your changes.