{"id":176,"date":"2003-11-12T12:00:00","date_gmt":"2003-11-12T12:00:00","guid":{"rendered":"http:\/\/editorium.com\/archive\/?p=176"},"modified":"2013-10-25T23:10:21","modified_gmt":"2013-10-25T23:10:21","slug":"title-case-macro-version-2","status":"publish","type":"post","link":"https:\/\/editorium.com\/archive\/title-case-macro-version-2\/","title":{"rendered":"Title Case Macro, Version 2"},"content":{"rendered":"<p>Last week's newsletter featured a macro to change all-cap headings into title case. It had some drawbacks, though. It would do only one heading level at a time, and you had to specify which heading level you wanted it to work on. In addition, it didn't lowercase articles, prepositions, and conjunctions. What's really needed is a macro that will cycle through *all* of your heading levels (any paragraph styled with one of Word's Heading paragraph styles, such as Heading 1), make them title case, and lowercase articles, prepositions, and conjunctions unless they occur at the beginning or end of the heading. Oh, and one more thing: It should capitalize any word following a colon and a space. I'm giving away the store here, but here's the macro, which I hope you'll find useful:<\/p>\n<pre><span style=\"color: black; font-family: Courier New; font-size: small;\">\n'MACRO BEGINS HERE\nSub TitleCaseHeadings()\n'Created by Jack M. Lyon\n'http:\/\/www.editorium.com\nFor h = 1 To 9\nSelection.HomeKey Unit:=wdStory\nSelection.Find.ClearFormatting\nmyHeading$ = \"Heading\" + Str(h)\nSelection.Find.Style = ActiveDocument.Styles(myHeading$)\nWith Selection.Find\n.Text = \"\"\n.Replacement.Text = \"\"\n.Forward = True\n.Wrap = wdStop\n.Format = True\n.MatchCase = False\n.MatchWholeWord = False\n.MatchWildcards = False\n.MatchSoundsLike = False\n.MatchAllWordForms = False\nEnd With\nSelection.Find.Execute\nWhile Selection.Find.Found = True\nSelection.Range.Case = wdTitleWord\nFor Each wrd In Selection.Range.Words\nSelect Case Trim(wrd)\nCase \"A\", \"An\", \"As\", \"At\", \"And\", \"But\", _\n\"By\", \"For\", \"From\", \"In\", \"Into\", \"Of\", _\n\"On\", \"Or\", \"Over\", \"The\", \"Through\", _\n\"To\", \"Under\", \"Unto\", \"With\"\nwrd.Case = wdLowerCase\nEnd Select\nNext wrd\nwrdCount = Selection.Range.Words.Count\nSelection.Range.Words(1).Case = wdTitleWord\nSelection.Range.Words(wrdCount - 1).Case = wdTitleWord\nstrLength = Selection.Range.Characters.Count\nFor i = 1 To strLength\nIf Selection.Range.Characters(i) = \":\" Then\nSelection.Range.Characters(i + 2).Case = wdTitleWord\nEnd If\nNext i\nSelection.Find.Execute\nWend\nNext h\nMsgBox \"Finished!\", , \"Title Case Headings\"\nEnd Sub\n'MACRO ENDS HERE\n<\/pre>\n<p><\/span><\/p>\n<p>If you don't know how to use macros like that one, you can learn how <a href=\"https:\/\/editorium.com\/archive\/using-found-macros\/\" target=\"_blank\">here.<\/a><\/p>\n<p>If you're wondering why you'd want to use a macro like that one, please see my article \"The Case against Caps\":<\/p>\n<p>http:\/\/www.topica.com\/lists\/editorium\/read\/message.html?mid=1705080679<\/p>\n<p>Please note that you can modify the macro to specify the words you want to be lowercased. Here are the lines you'll need to change:<\/p>\n<p>Case \"A\", \"An\", \"As\", \"At\", \"And\", \"But\", _<\/p>\n<p>\"By\", \"For\", \"From\", \"In\", \"Into\", \"Of\", _<\/p>\n<p>\"On\", \"Or\", \"Over\", \"The\", \"Through\", _<\/p>\n<p>\"To\", \"Under\", \"Unto\", \"With\"<\/p>\n<p>For example, if you wanted to add \"Throughout,\" the modified lines might look like this:<\/p>\n<p>Case \"A\", \"An\", \"As\", \"At\", \"And\", \"But\", _<\/p>\n<p>\"By\", \"For\", \"From\", \"In\", \"Into\", \"Of\", _<\/p>\n<p>\"On\", \"Or\", \"Over\", \"The\", \"Through\", _<\/p>\n<p>\"To\", \"Under\", \"Unto\", \"With\", \"Throughout\"<\/p>\n<p>You can also delete words. For example, if you wanted to delete \"As,\" the modified lines would look like this:<\/p>\n<p>Case \"A\", \"An\", \"At\", \"And\", \"But\", _<\/p>\n<p>\"By\", \"For\", \"From\", \"In\", \"Into\", \"Of\", _<\/p>\n<p>\"On\", \"Or\", \"Over\", \"The\", \"Through\", _<\/p>\n<p>\"To\", \"Under\", \"Unto\", \"With\"<\/p>\n<p>Don't worry about getting the lines too long. You won't. The lowlines _ at the end of each line just break up the macro for easy reading. You can delete them and the following paragraph returns to merge the four lines if you want to.<\/p>\n<p>By the way, you don't have to reserve the macro for changing headings in all caps. You can use it on any headings that need to be changed to true title case. This does not, however, excuse you from editing your headings.<\/p>\n<p>Thanks to Hilary Powers for suggesting the improvements.<\/p>\n<\/p>\n<p>_________________________________________<\/p>\n<p>READERS WRITE<\/p>\n<p>Peg Wier wrote:<\/p>\n<p>I agree with you on all counts about the formatting of headings with all caps. I think you left out the most important case against all caps--THEY ARE HARD TO READ!<\/p>\n<p>Bruce White wrote about converting Word documents to HTML:<\/p>\n<p>There are a whole bunch of tools that grew from WinHelp tools. Reworx grew out of HDK by Virtual Media. See the Republicorp website:<\/p>\n<p><http:\/\/www.vmtech.com\/reworx.htm><\/p>\n<p>Instead of cleaning up Word HTML what you do is get the tool to generate the code from the Word document. It breaks the document into separate HTML pages based on the heading styles in the document. It will preserve the index entries, the links and especially the outline structure (levels of headings--which you can use it in a TOC if you want).<\/p>\n<p>OR the pages can be passed to Dreamweaver and maintained there.<\/p>\n<p>Many thanks for the help and suggestions.<\/p>\n<\/p>\n<p>_________________________________________<\/p>\n<p>RESOURCES<\/p>\n<p>Ever heard of a candrabindu? Want to know the difference between oblique and inclined? You can learn all kinds of interesting things from the Encyclopedia of Typography and Electronic Communication:<\/p>\n<p>http:\/\/ourworld.compuserve.com\/homepages\/profirst\/encycl2.htm#index<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/editorium.com\/archive\/title-case-macro-version-2\/\" rel=\"bookmark\" title=\"Permalink to Title Case Macro, Version 2\"><p>Last week&#8217;s newsletter featured a macro to change all-cap headings into title case. It had some drawbacks, though. It would do only one heading level at a time, and you had to specify which heading level you wanted it to work on. In addition, it didn&#8217;t lowercase articles, prepositions, and conjunctions. What&#8217;s really needed is [&hellip;]<\/p>\n<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3],"tags":[],"class_list":{"0":"post-176","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-editing","7":"h-entry","8":"hentry"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3gfno-2Q","_links":{"self":[{"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts\/176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/comments?post=176"}],"version-history":[{"count":3,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts\/176\/revisions"}],"predecessor-version":[{"id":829,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts\/176\/revisions\/829"}],"wp:attachment":[{"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/media?parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/categories?post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/tags?post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}