View Single Post
 
Old 10-05-2023, 11:48 PM
RobiNew RobiNew is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Sep 2023
Posts: 208
RobiNew is on a distinguished road
Default

Hi Vivka! Of course there are no multiple spaces in my case (thanks to Guessed for "^w^p"!). If you mean space+^p within a footnote, I agree with you that Find-Replace does its job on footnotes nicely. But what I meant from the start is space+^p at the end of a footnote. In my footnotes there is only one ^p at the end. And this you cannot replace. If you try a Find-Replace without using a macro, you will see what I mean. The code I originally posted works even for the ^p at the end, because it deletes the space. But I wanted a faster solution. Perhaps you could modify the following code (which inserts spaces before ^p in the text and footnotes) to make it DELETE spaces before ^p.

Code:
Sub InsertSpace()
Dim aRng As Range
Dim iType As Integer
Dim Para As Paragraph
  For iType = 1 To 2
Set aRng = ActiveDocument.StoryRanges(iType)
For Each Para In aRng.Paragraphs
Para.Range.Characters.Last.InsertBefore " "
Next Para
Next iType
Set aRng = Nothing
End Sub
Reply With Quote