Tag Archives: recording macros

Canadian contact solves Gloucestershire copywriter’s Word 2003 macro quandary

I’m reading Geoff Hart’s great book Effective onscreen editing: New tools for an old profession (2nd edition) at the moment. As a busy Gloucestershire copywriter and copy-editor , it’s always useful to mine gems from one of the recognised masters of technical editing and tech writing.

Calling Ottawa…

Because I periodically have to edit text within HTML tags I was really interested in Geoff’s explanation of a Word macro to change the HTML tags to an unobtrusive grey colour. This makes it much easier to concentrate on the text content contained between the tags. Four hours into trying unsuccessfully to get the macro to work, I realised that something was wrong. Not sure whether it was my limited macro knowledge or simply ‘Word being Word’ I emailed Geoff in Ottawa, Canada. That was at 21.00 last night. Imagine my delight this morning when I discovered a fast and friendly email response from Geoff, explaining that there’s a known bug with font colours in W2003’s Find and Replace function and that it causes problems when you try to record a macro. So this Gloucestershire copywriter wasn’t going mad after all… (Geoff has subsequently added a note to the book’s errata website.)

A great macro for use when editing text in HTML pages

Even better, Geoff had kindly worked out an alternative that works a treat in Word 2003 (the bug was fixed from Word 2007 onwards). It’s a great macro, especially when assigned a keyboard shortcut. Start with your page of text, enshrouded in HTML tags, click your shortcut and watch the ‘meaty text’ jump out of the page as the HTML is knocked back into understated grey. Once your editing is finished, simply convert everything back to black and you’re good to go. Simples! (as that meerkat says on TV).

Here, with Geoff’s blessing, is a copy of the macro to convert the HTML tags into a light grey font:

Sub HideTags()

‘ HideTags Macro
‘ Macro recorded 21 February 2011 by

With Selection.Find
.Text = “[]”
.Replacement.Text = “^&”
.Replacement.Font.Color = wdColorGray25
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub

Recommended by the sfep

For more of the same and 735 information-packed pages on every possible aspect of on-screen editing, I can’t recommend Geoff’s book highly enough (it’s also recommended by the UK Society for freelance editors and proofreaders). You can find more details and information on how to buy a copy on his editing, writing and translation website. It’s a great read, packed with useful information and insights, written by a really decent guy.

Thank you again Geoff.