Title Case Macro

During my other life as a copyeditor, I often find myself needing to change the case of words that an author has typed in all caps, LIKE THIS, in chapter titles and subheads. I often perform the task with the handy Cap Title Case feature in my Editor's ToolKit program, but I've also wished for a macro that would do most of the dirty work automatically throughout a document without having to select text. So, I decided to write one. Here it is:


'MACRO BEGINS HERE
Sub FixCaps()
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Heading 1")
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
While Selection.Find.Found = True
Selection.Range.Case = wdTitleWord
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find.Execute
Wend
MsgBox "Finished!", , "Fix Caps"
End Sub
'MACRO ENDS HERE

If you don't know how to use macros like that one, you can learn how here.

The macro goes through your document finding any words formatted with the Heading 1 paragraph style and changes them to title case. Of course, you'll still need to lowercase articles, prepositions, and conjunctions by hand, but at least the macro keeps you from having to change *everything* by hand.

If you're wondering why you'd want to change all caps to title case, please see my article "The Case against Caps":

http://www.topica.com/lists/editorium/read/message.html?mid=1705080679

Worried about all caps in other heading styles? You can modify the macro to find them by changing this line:

Selection.Find.Style = ActiveDocument.Styles("Heading 1")

For example, if I wanted to find text formatted with Heading 2 rather than Heading 1, I would change the line to this:

Selection.Find.Style = ActiveDocument.Styles("Heading 2")

You can also modify the case the macro will use to change the text it finds. Currently, it makes words title case, as specified in the following line:

Selection.Range.Case = wdTitleWord

Rather than using "wdTitleWord" (title case), however, you can use the following, if you prefer:

wdLowerCase (which formats the words in lower case).

wdTitleSentence (Which formats the words in sentence case).

Now the next time you need to change the case of a bunch of all-cap headings, you'll have an easy way to get the job done.

You can learn about Editor's ToolKit here:

http://www.editorium.com/14857.htm

_________________________________________

READERS WRITE

Last week Brad Hurley asked for help in cleaning up HTML from Word, and in particular copying the text of a Word document and pasting it into a Dreamweaver page while preserving basic text formatting (headings and any bold or italic body text) and hyperlinks that were created in the Word document.

Keith Soltys responded:

Your reader who wants to be able to get Word into Dreamweaver might want to take a look at the YAWC Pro plugin for Word:

http://www.yawcpro.com/

According to their web site:

"YAWC Pro generates HTML which is much cleaner and smaller than that generated by MS-Word itself. It also places the content of the Word document into a pre-defined HTML template, so that the output HTML is ready for immediate publication on a website. YAWC Pro avoids the need for post-conversion clean-up of HTML documents, and avoids the need for most content creators to have anything but the most basic knowledge of HTML."

It also can generate XML.

Looks like an interesting tool, but I haven't tried it so I can't offer an opinion on how successful it is.

As far as being able to just copy and paste into Dreamweaver, I don't think there's any way he's going to be able to do it without an intermediate conversion first.

Gaston Brisbois suggested using converters from Logictran:

http://www.logictran.net/products/

http://www.bykeyword.com/pages/detail7/download-7337.html

Cecelia Munzenmaier wrote:

Dreamweaver MX has an Import option that will automatically clean up Word HTML, as well as a separate "Clean Up Word HTML" command. If that's not heavy-duty enough, there's also Word Cleaner; I have no personal knowledge of it, but there's a description here:

http://www.wordcleaner.com/dreamweaver_details.htm

LeAnne Baird wrote:

I'd recommend looking at WebWorks Publisher for Word by Quadralay. With it you can map styles in Word to web styles and control how the formatting is changed on the web side. It's really slick once you get your their standard template customized for your look and feel.

You don't even have to cut and paste. Just run the WebWorks conversion utility on your file and you're done.

http://www.webworks.com/products/wwpp_w/default.aspx

Many thanks to all for their help and suggestions.

This entry was posted in Editing. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

You must be logged in to post a comment.

  • The Fine Print

    Thanks for reading Editorium Update (ISSN 1534-1283), published by:

    The EDITORIUM, LLC
    http://www.editorium.com

    Articles © on date of publication by the Editorium. All rights reserved. Editorium Update and Editorium are trademarks of the Editorium.

    You may forward copies of Editorium Update to others (but not charge for it) and print or store it for your personal use. Any other broadcast, publication, retransmission, copying, or storage, without written permission from the Editorium, is strictly prohibited. If you’re interested in reprinting one of our articles, please send an email message to editor@editorium.com

    Editorium Update is provided for informational purposes only and without a warranty of any kind, either express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, and freedom from infringement. The user (you) assumes the entire risk as to the accuracy and use of this document.

    The Editorium is not affiliated with Microsoft Corporation or any other entity.

    We do not sell, rent, or give our subscriber list to anyone. Period.

    If you’d like to subscribe, please enter your name and email address below. We publish the newsletter once a week, and on rare occasions we may send an important announcement. We never, ever send spam. Thank you for signing up!