![]() |
|
#1
|
|||
|
|||
|
I need to insert a spacing character " " before a hard return. I've tried the code here below, but it produces an error. Any idea? Thanks!
Code:
Sub Problem() 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 |
|
#2
|
|||
|
|||
|
RobiNew, your code works smoothly on my documents.
|
|
#3
|
|||
|
|||
|
Hi Vivka! It works in the text sector, but in the footnote sector it gives this error: "Runtime Error.
Invalid operation for the end of a line". Thanks! |
|
#4
|
|||
|
|||
|
It's amazing, because I don't have this error neither on the main text, nor on the footnotes. I will try to experiment.
|
|
#6
|
|||
|
|||
|
RobiNew, please, see the attached pics (Before and After running your code):
|
|
#7
|
|||
|
|||
|
Hi, Vivka! Of course you are right. The code in question gives an error only in one specific (very large) doc, which I cannot upload because it contains sensitive material. Sorry to have troubled you with this problem. Thanks! À la prochaine!
|
|
#8
|
|||
|
|||
|
Bye until next time!
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Replace a hard return with a dash in the text of a footnote | RobiNew | Word VBA | 3 | 11-02-2023 09:22 AM |
| Macro for Find/replace to remove space before Hard Return | AlfredStreich | Word VBA | 4 | 01-23-2020 03:59 PM |
Find / Replace hard Carriage Return with Line break.
|
GreenBoy | Word | 2 | 03-11-2018 02:32 AM |
| Hard return renders upper case | clafond | Word | 2 | 01-07-2013 12:26 PM |
| Hard page return? | markg2 | Outlook | 0 | 09-11-2012 08:49 AM |