Thread: [Solved] Toggle Button
View Single Post
 
Old 06-11-2014, 11:58 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

You have a space between .Font and .Hidden. This should cause a syntax error. I just made something similiar myself, except I did not use a command button. I inserted a bookmark called "HelpText" and then, in the line just above the bookmark, I pressed Ctrl+F9 and inside the {} that appeared I wrote: MACROBUTTON ToggleHelp Toggle
Then I pressed Alt+F9 to activate it. The code for the ToggleHelp macro I wrote follows:
Code:
Sub ToggleHelp()
'///////////////////////////////////////////////////////////////////////////////////
'///////////////This function toggles the instructions for use//////////////////////
'///////////////////////////////////////////////////////////////////////////////////
If (ActiveDocument.Bookmarks("HelpText").Range.Font.Hidden) Then
    ActiveDocument.Bookmarks("HelpText").Range.Font.Hidden = False
Else
    ActiveDocument.Bookmarks("HelpText").Range.Font.Hidden = True
End If
'//////////////////END//////////////////////////////////////////////////////////////
End Sub
That way you just double click the word "Toggle" and it hides/shows the bookmarked block.

Last edited by jpb103; 06-11-2014 at 12:07 PM. Reason: added code
Reply With Quote