Toggling Hidden Codes and Text
When you choose Home, Show/Hide, Word displays symbols that represent hidden “characters,” such as tabs, spaces, paragraph marks, and optional hyphens, as well as any text formatted as hidden.
This is handy for looking “under the hood” of the document. However, a thorough check of a document’s inner workings should also include other normally hidden items: bookmarks, comments, revisions, and field codes.
You can toggle all of these by hand individually, but if you need to do this often, the procedure in Listing 1.3 is much easier.
Listing 1.3 Toggling Hidden Codes and Text
Public Sub ShowAll()
Dim currentState As Boolean
With ActiveWindow.View
currentState = .ShowBookmarks
.ShowBookmarks = Not currentState
.ShowComments = Not currentState
.ShowFieldCodes = Not currentState
.ShowHiddenText = Not currentState
.ShowHyphens = Not currentState
.ShowOptionalBreaks = Not currentState
.ShowParagraphs = Not currentState
.ShowRevisionsAndComments = Not currentState
.ShowSpaces = Not currentState
.ShowTabs = Not currentState
.Type = wdNormalView
End With
End Sub
The procedure is named ShowAll, which is the internal name of the command that Word runs when you click the Show/Hide button. Therefore, clicking Show/Hide will now run the ShowAll procedure. Using the active window’s View object, the program first checks the current state of the ShowBookmarks property and stores the state in the currentState variable.
Then each of the View properties is set to the opposite value. Figure 1.15 and 1.16 show the two states produced by the procedure.
// Related Posted - GOOGLE!
Related Websites
- Robert G Allen, Grants, and a Credit Card Slimeball Introduction This is a small investigation into mail lists and scammy companies. Some companies are fine, but I always go...
- Excel How-to: A Macro to Hide Blank Rows on a Spreadsheet Today, a coworker asked me how to hide a row on his Excel spreadsheet. This was a fairly large spreadsheet,...
- Secrets of a Great Goose Hunt One of the secrets to a great goose hunt is proper scouting. You need to really scout out the geese...
- Armani Code By Giorgio Armani For Men. Eau De Toilette Spray 4.2 Oz. User Reviews Send this to a friend Armani Code By Giorgio Armani For Men. Eau De Toilette Spray 4.2 Oz....
- Patchouli Incense Sticks Six-pack (20 Sticks Per Pack) Box User Reviews Send this to a friend Patchouli Incense Sticks Six-pack (20 Sticks Per Pack) Box Manufacturer: HEM Customer Rating:...


