![]() |
|
#1
|
|||
|
|||
![]()
Hi, RobiNew! This is a workaround to delete spaces ending paragraphs only in footnotes but it is the fastest method:
Code:
Sub Footnotes_Spaces_Del() 'In the doc's footnotes, delete spaces ending paragraphs. Dim oRng As range Application.ScreenUpdating = False Set oRng = ActiveDocument.StoryRanges(2) With oRng.Find .ClearFormatting .Replacement.ClearFormatting 'Find one space and an invisible paragraph sign: .text = " ^p" 'Add an extra space (or more in case there are extra spaces elsewhere in footnotes) 'before a paragraph end (note that the para sign is absent here!): .Replacement.text = " " .MatchWildcards = False .Execute Replace:=wdReplaceAll End With With oRng.Find 'Find more than one space (in case of error, replace ; with comma): .text = Chr(32) & "{2;}" 'Delete them: .Replacement.text = "" .MatchWildcards = True .Execute Replace:=wdReplaceAll End With Application.ScreenUpdating = True Set oRng = Nothing End Sub on several footnotes on the same page. This is the reason for my misunderstanding. If you want to include the main text in the macro, add this just after ScreenUpdating = False line: With ActiveDocument.range.Find .ClearFormatting .Replacement.ClearFormatting .text = "^w^p" .Replacement.text = "^p" .MatchWildcards = False .Execute Replace:=wdReplaceAll End With |
#2
|
|||
|
|||
![]()
Hi Vivka! Sorry, but your code does not work on automatic footnotes. The reason for this is that it is again based on a replacement action which is not allowed (even if ^p is absent in the .Replacement.text). If it were possible to replace footnote ending paragraphs, then any user could destroy the footnotes by mistake. If you try a Find&Replace action of the type ^p ---> "" (or ---> ^l) on any text with multiple paragraphs you will get a single paragraph. If you could do that in the automatic footnotes area you would get a single footnote out of a whole series of footnotes.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
gemmajackson7 | Word | 1 | 05-16-2021 07:26 AM |
![]() |
JulianS96 | Word | 4 | 02-04-2020 04:20 AM |
![]() |
sharina1985 | Mail Merge | 1 | 10-05-2019 03:52 AM |
big spaces appearing automatically in certain parts of the text - how to remove them | pratodifuoco | Word | 2 | 05-26-2017 12:55 PM |
editing text and remove spaces | romanticbiro | Word VBA | 5 | 07-04-2014 07:42 PM |