Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-23-2014, 08:17 AM
jpb103's Avatar
jpb103 jpb103 is offline Collapsing headings of same levels but different content Windows 7 64bit Collapsing headings of same levels but different content 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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Collapsing headings of same levels but different content Multiple Userforms Displaying Different Content but Returning Same Content? marksm33 Word VBA 1 02-24-2014 06:17 PM
Collapsing headings of same levels but different content More than 10 levels in TOC NobodysPerfect Word 4 02-07-2014 12:10 AM
Collapsing headings of same levels but different content macro for change content of cell2 when content of cell1 changes Intruder Excel Programming 1 11-17-2012 08:24 PM
Collapsing headings of same levels but different content Help with expanding/collapsing lists of check boxes Craigap Word VBA 3 02-05-2012 02:34 PM
Package for CD with links to Windows media player content and Flash Shockwave content hectorh PowerPoint 4 10-15-2009 12:22 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:05 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft