Tuesday, July 26, 2011

ToggleShowAll

I assign this cute trick to the Shift-Ctrl-8 keyboard shortcut.
It flip-flops between showing everything that's going on in my document, to showing nothing but pristine text and graphics.


Public Sub ToggleShowAll()
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' Function: ToggleShowAll
'''
''' Comments: Use the current "Show Fields" setting (True or False) to toggle all visibility settings.
'''
''' Arguments: None.
'''
''' Returns: None
'''
''' Date Developer Action
''' --------------------------------------------------------------------------
''' 2006/03/21 Chris Greaves Created
'''
''' The setting ShowFieldCodes will be used to control the settings of ShowFieldCodes, ShowAll , ShowFieldCodes , ShowHiddenText , ShowTabs , ShowSpaces , ShowParagraphs and ShowBookmarks.
''' All flags will be set to the opposite of the current setting of ShowFieldCodes.
''' If ShowFieldCodes is ON, all flags will be set OFF.
''' If ShowFieldCodes is OFF, all flags will be set ON.
''' The new setting will be saved as the key "Show All" in the Application Environment file.
If Documents.Count > 0 Then
Dim boolSet As Boolean
boolSet = Not ActiveWindow.View.ShowFieldCodes
With ActiveWindow.View
.ShowAll = boolSet
.ShowFieldCodes = boolSet
.ShowHiddenText = boolSet
.ShowTabs = boolSet
.ShowSpaces = boolSet
.ShowParagraphs = boolSet
.ShowBookmarks = boolSet
End With
Dim strSet As String
If boolSet Then
strSet = "Y"
Else
strSet = "N"
End If
Else
End If
End Sub