View Single Post
 
Old 06-23-2014, 08:17 AM
jpb103's Avatar
jpb103 jpb103 is offline Windows 7 64bit Office 2007
Advanced Beginner
 
Join Date: May 2014
Location: Thunder Bay, Ontario
Posts: 58
jpb103 is on a distinguished road
Default

I'm not certain it would work but if you want to give it a try, just select all the text in a section of your document you wish to hide, then click Insert -> Bookmark and give it an appropriate name (i.e. Bob1 or John1). Then you could write a macro for collapsing/expanding the bookmarked area, something like this:
Code:
Sub ToggleSection(strSection as String)
If (ActiveDocument.Bookmarks(strSection).Range.Font.Hidden) Then
    ActiveDocument.Bookmarks(strSection).Range.Font.Hidden = False
Else
    ActiveDocument.Bookmarks(strSection).Range.Font.Hidden = True
End If
End Sub
Where strSection is the name of the bookmark for the area you wish to expand or collapse. As for how to activate this macro, you could put a command button at each expand/collapse point that calls the ToggleSection macro (passing the name of the bookmark for that section), or you could do a Ctrl+F9 and in the {} that appear, write "MACROBUTTON ToggleSection("BookmarkName") Toggle" (without quotes). Then you press Alt+F9 to confirm and set up the button (which will just say "Toggle" and will expand/collapse the section whenever it is double clicked). You could, of coarse change the last word in the curly brackets to say anything (it doesn't have to be "Toggle").
Reply With Quote