Word: Macro to show field shading etc.September 1, 2010
The Word 2007 documents I’ve been working on have been written by numerous authors, both on my team and third party consultants. Although we’re all meant to use the same template, there’s no guarantee that an author can see the automated things in the template — things such as field shading, bookmark indicators, and table grid lines.
As a result, many authors inadvertently delete something they shouldn’t (such as a field or bookmark), or aren’t aware of something they should be aware of (such as a borderless table).
So I’ve created a macro that will turn on field shading, show bookmarks, and turn on table grid lines. Many thanks to Hamish Blunck who helped me with the table grid line section — as it’s a toggle switch, I couldn’t figure out how to turn it on if it’s off, yet ignore it if its already on. Hamish sorted that for me in about 1 minute flat!
I recorded the macro in Word 2007; it may also work in Word 2003 though I haven’t tested it there. Here’s the macro:
Sub ShowFieldsEtc() ' ShowFieldsEtc Macro ' Show field shading, show bookmarks, show table gridlines ' ActiveWindow.View.ShowBookmarks = True ActiveWindow.View.FieldShading = wdFieldShadingAlways If ActiveDocument.ActiveWindow.View.TableGridlines = False Then ActiveDocument.ActiveWindow.View.TableGridlines = True End If End Sub