#1
|
|||
|
|||
Remove extra carriage returns in footnotes
Is there a way to remove extra carriage returns in footnotes with a macro? Thanks! |
#2
|
|||
|
|||
Quote:
Try this. I found in Lyonizing Word: Deleting Extraneous Carriage Returns in Footnotes and Endnotes | An American Editor Code:
Sub CleanReturnsInNotes() NoteCount = ActiveDocument.Footnotes.Count Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^p^p" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False End With Selection.Find.Execute On Error GoTo TrapTheError While Selection.Find.Found Selection.MoveLeft Selection.Delete Selection.Find.Execute Wend GoTo TheEnd TrapTheError: ErrorCount = ErrorCount + 1 Selection.MoveRight Selection.Delete If ErrorCount < NoteCount Then Resume Next TheEnd: End Sub |
#3
|
|||
|
|||
Many thanks, yanyan9896! I now see that I was wrong in putting the question that way. The macro you posted does remove extra (= empty) carriage returns in footnotes, but what I need is code to remove all carriage returns except, of course, the ending one. Any idea?
|
#4
|
|||
|
|||
Quote:
Do you mean to remove all carriage returns in the footnote? Or do you mean remove all carriage returns in the whole document? Do note you don't need a macro for this; it can be done with an ordinary Find/Replace, where: Find = ^p^p Replace = ^p See https://www.msofficeforums.com/word-...e-returns.html |
#5
|
|||
|
|||
I mean that the macro should remove all carriage returns in the footnotes except, of course, the ending ^p. Thanks!
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
replace cell text results in extra carriage return | abonsey | Word VBA | 2 | 05-27-2022 02:55 AM |
Converting table to text (and back) with carriage returns in cells, split and merged cells | ndajko | Word | 5 | 11-04-2019 07:53 AM |
Macro To Delete Specific Carriage Returns | NeviZero | Word VBA | 2 | 02-09-2018 02:16 PM |
Remove Carriage Returns in Address Block Merge field | alan100 | Mail Merge | 5 | 12-12-2017 08:32 PM |
Run Script to remove carriage returns on certain columns | ryanjohnsond@gmail.com | Excel Programming | 34 | 09-03-2014 10:43 PM |