2 Smart Ways to Collapse or Expand Parts of Your Word Document

In this article, we are going to offer you 2 smart ways to collapse or expand parts of your Word document.

Every now and then, have you wonder how wonderful it would be if you can collapse a certain range of document to view two nonconsecutive parts? The good news is there is this built-in feature in Word 2013 and versions later.

If you have Word 2013 or version later, you may refer to this link to know more about the function: https://support.microsoft.com/en-us/office/collapse-or-expand-parts-of-a-document-701786e0-95e2-40bf-bfe5-f0233cd3520c

However, if you are using Word 2010 or versions earlier, there is no such luck. For this reason, we found 2 solutions you can adopt in versions prior to Word 2013.

Method 1: Collapse or Expand a Single Part of a Document

  1. First off, select the text you want to collapse.
  2. Next click “Insert” tab.
  3. Then click “Bookmark” in “Links” group to open the “Bookmark” dialog box.
  4. Enter a bookmark name in the text box and click “Add” to create a bookmark for the selected content.Click "Insert"->Click "Bookmark"->Enter Bookmark Name->Click "Add"
  5. Now press “Alt+ F11” to open the VBA editor.
  6. Next click “Normal” and then the “Insert” tab.
  7. Choose “Module”.Click "Normal"->Click "Insert"->Click "Module"
  8. Double click on module to open the coding area on the right side and paste the following codes:


Sub CollapseOrExpandTheSelectedText1()
  ActiveDocument.Bookmarks("Introduction").Range.Font.Hidden = _
    Not ActiveDocument.Bookmarks("Introduction").Range.Font.Hidden
End Sub


  • You can change the macro name to whatever you want to call it.
  • The “Introduction” refers to the bookmark name. Make sure it is as same as the name you entered in step 4.
  1. Click “Save” to save the macro.Paste Codes->Click "Run"
  2. Next put insertion pointer near the bookmark but never inside it. For instance, we place it at the line above the selected text.
  3. Then press “Ctrl+ F9” to insert a field.
  4. Inside the field, enter the bellowing codes:
     MACROBUTTON CollapseOrExpandTheSelectedText1 Introduction


  • The “CollapseOrExpandTheSelectedText1” is the macro name in step 8.
  • The “Introduction” is the label you want to show on the button.Insert Field->Enter Codes
  1. Now press “Alt+ F9” and you shall see the button.
  2. Double click on the button to either expand or collapse the text.The Collapse or Expand Button

Method 2: Collapse or Expand Multi-part of a Document

If you apply method 1 to create several buttons to collapse or expand contents, you can use the following method to show or hide the texts in batches.Buttons to Collapse or Expand Multiple Parts of Document

  1. Repeat from step 5 to 8 in method 1.
  2. Then to collapse all texts, paste this macro there:
Sub CollapseAllSelectedTexts()
  Dim objBookmark As Bookmark

  For Each objBookmark In ActiveDocument.Bookmarks
    objBookmark.Range.Font.Hidden = True
End Sub

To expand all texts, you will need this one:

Sub ExpandAllSelectedTexts()
  Dim objBookmark As Bookmark

  For Each objBookmark In ActiveDocument.Bookmarks
    objBookmark.Range.Font.Hidden = False
End Sub
  1. Next click “Run” or hit “F5”.

Besides, you can take step 10 to 14 in method 1 to create buttons in the document to expand or collapse all texts at once.Create Buttons to Collapse or Expand All Texts

Cope with the Consequences of Word Failure

Word fails from time to time. And there are consequences. Some of them are fine while others can get you busy in recovering the data back. If the latter is your case, you’d better choose a doc recovery tool to help you with the business.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xlsx damage and pdf repair software products. For more information visit www.datanumen.com

2 responses to “2 Smart Ways to Collapse or Expand Parts of Your Word Document”

  1. Thank you for this. I am an intern and it helped with an assignment that took me a while to figure out. I was wondering if there is a way to make the macro button turn red when the text is hidden?

Leave a Reply

Your email address will not be published. Required fields are marked *