{"id":908,"date":"2014-05-22T17:04:35","date_gmt":"2014-05-22T23:04:35","guid":{"rendered":"http:\/\/editorium.com\/archive\/?p=908"},"modified":"2014-05-22T22:49:57","modified_gmt":"2014-05-23T04:49:57","slug":"deleting-extraneous-carriage-returns-in-footnotes-and-endnotes","status":"publish","type":"post","link":"https:\/\/editorium.com\/archive\/deleting-extraneous-carriage-returns-in-footnotes-and-endnotes\/","title":{"rendered":"Deleting Extraneous Carriage Returns in Footnotes and Endnotes"},"content":{"rendered":"<p>During my editing career, I\u2019ve often run into problems with footnotes and endnotes in Microsoft Word. Many authors have no clue about how notes are meant to work, and Microsoft certainly hasn\u2019t made it obvious. In fact, they\u2019ve made it easy to mess notes up beyond repair.<\/p>\n<p>One mistake authors make is to insert extraneous carriage returns before or after a note. Why? Because they don\u2019t like the positioning of the note on the page, which they\u2019re trying to make \u201cpretty,\u201d not understanding the problems that will cause in editing and typesetting.<\/p>\n<p>You can try to remove the extraneous returns like this:<\/p>\n<p style=\"padding-left: 30px;\">1. Click View &gt; Draft.<br \/>\n2. Click References &gt; Show Notes.<\/p>\n<p>Your cursor should now be in the Notes pane.<\/p>\n<p style=\"padding-left: 30px;\">3. Click Home &gt; Replace.<br \/>\n4. In the \u201cFind What\u201d box, enter two paragraph codes:<\/p>\n<p style=\"padding-left: 60px;\">^p^p<\/p>\n<p style=\"padding-left: 30px;\">5. In the \u201cReplace With\u201d box, enter one paragraph code:<\/p>\n<p style=\"padding-left: 60px;\">^p<\/p>\n<p style=\"padding-left: 30px;\">\u00a06. Click the \u201cReplace All\u201d button.<\/p>\n<p>Word will replace some of the double returns, but not all of them. And if you try to delete some of the remaining returns, you\u2019ll get an error message:<\/p>\n<blockquote><p>\u201cThis is not a valid action for footnotes.\u201d<\/p><\/blockquote>\n<p>What\u2019s going on there is that not all carriage returns are created equal. Some of the returns are \u201cspecial\u201d note returns, and the only way to delete them is to delete the note itself back in the text.<\/p>\n<p>The solution? A macro, of course. But a macro with a twist. As we\u2019ve seen, you can\u2019t just find double returns and replace them with a single return (even in a macro). And trying to delete extra returns results in an error. So let\u2019s use that error!<\/p>\n<p>Before running the macro, you must be in Draft view, with your cursor at the top of the Notes pane. (How to get there is explained above.)<\/p>\n<p>In the macro, you\u2019ll see a couple of \u201ccomments,\u201d which are explanations or instructions intended for the person reading the code. Comments are preceded by a single quotation mark, which tells the macro to ignore the rest of the text on that line. They are usually displayed in green. For example, the first comment in the macro reads:<\/p>\n<pre style=\"padding-left: 30px;\"><span style=\"color: #339966;\">'To clean returns in endnotes rather than footnotes,\r\n'change \"Footnotes\" to \"Endnotes\" in the following line:<\/span><\/pre>\n<p>And now, here\u2019s the macro:<\/p>\n<pre style=\"padding-left: 30px;\">Sub CleanReturnsInNotes()\r\n<span style=\"color: #339966;\">'To clean returns in endnotes rather than footnotes,\r\n'change \"Footnotes\" to \"Endnotes\" in the following line:\r\n<\/span>NoteCount = ActiveDocument.Footnotes.Count\r\nSelection.Find.ClearFormatting\r\nSelection.Find.Replacement.ClearFormatting\r\nWith Selection.Find\r\n  .Text = \"^p^p\"\r\n  .Replacement.Text = \"\"\r\n  .Forward = True\r\n  .Wrap = wdFindContinue\r\n  .Format = False\r\n  .MatchCase = False\r\n  .MatchWholeWord = False\r\n  .MatchAllWordForms = False\r\n  .MatchSoundsLike = False\r\n  .MatchWildcards = False\r\nEnd With\r\nSelection.Find.Execute\r\nOn Error GoTo TrapTheError\r\nWhile Selection.Find.Found\r\n  Selection.MoveLeft\r\n<span style=\"color: #339966;\">  'The following line may trigger an error!\r\n<\/span>  Selection.Delete\r\n  Selection.Find.Execute\r\nWend\r\nGoTo TheEnd\r\nTrapTheError:\r\nErrorCount = ErrorCount + 1\r\nSelection.MoveRight\r\nSelection.Delete\r\nIf ErrorCount &lt; NoteCount Then Resume Next\r\nTheEnd:\r\nEnd Sub<\/pre>\n<p>Let\u2019s look at some of those lines.<\/p>\n<pre style=\"padding-left: 30px;\">NoteCount = ActiveDocument.Footnotes.Count<\/pre>\n<p>NoteCount is a variable; that is, it\u2019s a container that can hold a numerical value\u2014in this case, the number of footnotes in the document. We get that value with the VBA command ActiveDocument.Footnotes.Count.<\/p>\n<pre style=\"padding-left: 30px;\">Selection.Find.ClearFormatting\r\nSelection.Find.Replacement.ClearFormatting<\/pre>\n<p>Just to be safe, these lines clear any formatting that might already be applied to the \u201cFind What\u201d and \u201cReplace With\u201d boxes in Word\u2019s find and replace feature.<\/p>\n<p>The following lines, from<\/p>\n<pre style=\"padding-left: 30px;\">With Selection.Find<\/pre>\n<p>down to<\/p>\n<pre style=\"padding-left: 30px;\">Selection.Find.Execute<\/pre>\n<p>simply find any instances of double paragraph returns. The replacement text is set to nothing, as we\u2019re not trying to replace those returns with anything:<\/p>\n<pre style=\"padding-left: 30px;\">.Replacement.Text = \"\"<\/pre>\n<p>Instead, we\u2019re going to try to delete the second return, which (unless the notes are really messed up) is a regular return rather than a special note return:<\/p>\n<pre style=\"padding-left: 30px;\">Selection.MoveRight\r\nSelection.Delete<\/pre>\n<p>If it\u2019s a special note return, then trying to delete it will cause an error, and the macro will execute this line\u2014<\/p>\n<pre style=\"padding-left: 30px;\">On Error GoTo TrapTheError<\/pre>\n<p>\u2014which sends the macro to this line:<\/p>\n<pre style=\"padding-left: 30px;\">TrapTheError:<\/pre>\n<p>Here\u2019s what happens next:<\/p>\n<pre style=\"padding-left: 30px;\">ErrorCount = ErrorCount + 1<\/pre>\n<p>Using the variable ErrorCount, we count the number of errors, adding 1 each time we find one. (ErrorCount is initially empty, or zero.)<\/p>\n<pre style=\"padding-left: 30px;\">Selection.MoveRight\r\nSelection.Delete<\/pre>\n<p>We move right and delete the next return.<\/p>\n<pre style=\"padding-left: 30px;\">If ErrorCount &lt; NoteCount Then Resume Next<\/pre>\n<p>If the number of errors is less than the number of notes, we\u2019re not through yet, as one of the remaining notes may still have a bad return next to it. So, we tell the macro to Resume operation at the next command after the error occurred. That command is:<\/p>\n<pre style=\"padding-left: 30px;\">Selection.Find.Execute<\/pre>\n<p>In other words, Word looks for the next occurrence of a double return. And this construction\u2014<\/p>\n<pre style=\"padding-left: 30px;\">While Selection.Find.Found\r\nSelection.MoveLeft\r\n  <span style=\"color: #339966;\">'The following line may trigger an error!<\/span>\r\n  Selection.Delete\r\n  Selection.Find.Execute\r\nWend<\/pre>\n<p>\u2014ensures that it will keep looking as long as (While) double returns are found. (\u201cWend\u201d is short for \u201cWhile End\u201d\u2014it marks the end of the While construction.)<\/p>\n<pre style=\"padding-left: 30px;\">GoTo TheEnd<\/pre>\n<p>When no more double returns are found, this line is executed. It exists simply to avoid executing the error trap (TrapTheError: and the following lines) after the macro is finished, at which point<\/p>\n<pre style=\"padding-left: 30px;\">TheEnd:<\/pre>\n<p>marks the end of the whole operation.<\/p>\n<p>I hope this explanation has helped you understand better how macros work, and in particular how you can actually use Word errors to force Word to do what you want it to do\u2014something that gives me great pleasure.<\/p>\n<p>Even if you don\u2019t understand everything that\u2019s going on in this macro, you can still use it to clean up extraneous returns in notes\u2014something that should make your editorial life a little bit easier.<\/p>\n<h3>How to Add the Macro to Word and to the QAT (Quick Access Toolbar)<\/h3>\n<p>Here\u2019s how to put this macro (or any other) into Microsoft Word so it will be available when you need it:<\/p>\n<ol>\n<li>Copy the text of the macro, starting with the first \u201cSub\u201d and ending with the last \u201cSub.\u201d<\/li>\n<li>Click the \u201cView\u201d tab on Microsoft Word\u2019s ribbon.<\/li>\n<li>Click the \u201cMacros\u201d button.<\/li>\n<li>Type a name for the macro in the \u201cMacro name\u201d box \u2014 probably the name used after the first \u201cSub.\u201d For this macro, that\u2019s \u201cCleanReturnsInNotes.\u201d<\/li>\n<li>Click the \u201cCreate\u201d button.<\/li>\n<li>Delete the \u201cSub [macro name]\u201d and \u201cEnd Sub\u201d lines that Word created in the macro window. The macro window should now be completely empty (unless you already have other macros in there).<\/li>\n<li>Paste the macro text at the current insertion point.<\/li>\n<li>Click \u201cFile,\u201d then \u201cClose and Return to Microsoft Word.\u201d<\/li>\n<\/ol>\n<p>To actually use the macro:<\/p>\n<ol>\n<li>Place your cursor at the beginning of the document.<\/li>\n<li>Click the \u201cView\u201d tab on Microsoft Word\u2019s ribbon.<\/li>\n<li>Click the \u201cMacros\u201d button.<\/li>\n<li>Click the name of your macro to select it.<\/li>\n<li>Click the \u201cRun\u201d button. (If you wanted to delete the macro, you could press the\u00a0\u201cDelete\u201d button instead.)<\/li>\n<\/ol>\n<p>Here\u2019s how to put the macro on Word\u2019s QAT (Quick Access Toolbar):<\/p>\n<ol>\n<li>Locate the QAT (it\u2019s probably on the top left of your screen either above or below Word\u2019s Ribbon interface).<\/li>\n<li>Right-click the QAT.<\/li>\n<li>Click \u201cCustomize Quick Access Toolbar.\u201d<\/li>\n<li>Under \u201cChoose commands from:\u201d click the dropdown list and select \u201cMacros.\u201d<\/li>\n<li>Find and select your macro in the list on the left.<\/li>\n<li>Click the \u201cAdd\u201d button to add it to the QAT.<\/li>\n<li>Click the \u201cOK\u201d button to finish.<\/li>\n<\/ol>\n<p><em>Jack Lyon (<\/em><a href=\"mailto:editor@editorium.com\"><em>editor@editorium.com<\/em><\/a><em>)\u00a0owns and operates the <\/em><a title=\"The Editorium\" href=\"http:\/\/www.editorium.com\" target=\"_blank\"><em>Editorium<\/em><\/a><em>, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of <\/em><a title=\"Microsoft Word for Publishing Professionals\" href=\"http:\/\/www.editorium.com\/msword4pubpros.htm\" target=\"_blank\">Microsoft Word for Publishing Professionals<\/a> <em>and of <\/em><a title=\"Macro Cookbook at Barnes &amp; Noble\" href=\"http:\/\/www.barnesandnoble.com\/w\/macro-cookbook-for-microsoft-word-jack-m-lyon\/1107868228?ean=9781434103321\" target=\"_blank\">Macro Cookbook for Microsoft Word<\/a>.<em> Both books will help you learn more about macros and how to use them.<\/em><\/p>\n<h2>Programs from the Editorium<\/h2>\n<p>Have you checked out the Editorium's latest Microsoft Word add-ins to help with your work?<\/p>\n<p><a href=\"http:\/\/www.editorium.com\/IndexLinker.htm\" target=\"_blank\">IndexLinker<\/a> creates hyperlinks from index page numbers back to the text to which they refer. If you're creating ebooks or PDFs with indexes, you need this program.<\/p>\n<p><a href=\"http:\/\/www.editorium.com\/BookMaker.htm\" target=\"_blank\">BookMaker<\/a> automates typesetting and page layout in Microsoft Word. Stop fighting with page breaks, headers, and footers. Let BookMaker do the heavy lifting.<\/p>\n<p><a href=\"http:\/\/www.editorium.com\/lyxconverter.htm\" target=\"_blank\">LyXConverter<\/a> converts Word documents into <a href=\"http:\/\/www.lyx.org\" target=\"_blank\">LyX<\/a> documents.<\/p>\n<p>And, of course, many other useful add-ins are available as well.<\/p>\n<h2 id=\"line\">A Special Deal: Editor's Toolkit Ultimate!<\/h2>\n<p><a href=\"http:\/\/www.editorium.com\/etkultimate.htm\" target=\"_blank\">Editor's ToolKit Ultimate<\/a> combines three great products:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.editorium.com\/14857.htm\" target=\"_blank\">Editor's ToolKit Plus<\/a> from The Editorium.<\/li>\n<li><a href=\"http:\/\/www.intelligentediting.com\/download.aspx\" target=\"_blank\">PerfectIt Pro<\/a> from Intelligent Editing.<\/li>\n<li><a href=\"http:\/\/wordsnsync.com\/download.php\" target=\"_blank\">EditTools<\/a> from WordnSync.<\/li>\n<\/ul>\n<p>The three products work together to create a powerful editing package to take you through <a href=\"http:\/\/americaneditor.wordpress.com\/2010\/08\/03\/the-3-stages-of-copyediting-i-the-processing-stage\/\" target=\"_blank\">three separate stages of copyediting<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/editorium.com\/archive\/deleting-extraneous-carriage-returns-in-footnotes-and-endnotes\/\" rel=\"bookmark\" title=\"Permalink to Deleting Extraneous Carriage Returns in Footnotes and Endnotes\"><p>During my editing career, I\u2019ve often run into problems with footnotes and endnotes in Microsoft Word. Many authors have no clue about how notes are meant to work, and Microsoft certainly hasn\u2019t made it obvious. In fact, they\u2019ve made it easy to mess notes up beyond repair. One mistake authors make is to insert extraneous [&hellip;]<\/p>\n<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3,6],"tags":[],"class_list":{"0":"post-908","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-editing","7":"category-macros","8":"h-entry","9":"hentry"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3gfno-eE","_links":{"self":[{"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts\/908","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=908"}],"version-history":[{"count":14,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts\/908\/revisions"}],"predecessor-version":[{"id":999,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/posts\/908\/revisions\/999"}],"wp:attachment":[{"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/media?parent=908"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/categories?post=908"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/editorium.com\/archive\/wp-json\/wp\/v2\/tags?post=908"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}