Thread: [Solved] Schrödinger's paragraph
View Single Post
 
Old 12-07-2024, 04:14 PM
genja genja is offline Windows 11 Office 2021
Novice
 
Join Date: Aug 2024
Posts: 3
genja is on a distinguished road
Default

Thanks again Greg. I Like the idea but I cannot get it to work the way you intend.

I get error 5560 on line
Code:
While .Execute
I've tried to modify the search string
Code:
.Text = Chr(13) & "{2,}"
to search for Chr(13)&Chr(13) for testing purposes. Doing this lets the code execute further and results in error 5 on line
Code:
Select Case AscW(oPar.Range.Characters.Last.Next)
The Problem seems to be with the .Next. Not sure if these methods can be combined like that.

Besides that, why exactly do you use step -1 and why a 'for x=z to y' loop? Wouldn't it be much faster to to iterate manually when dealing with large documents? Like
Code:
i = 1
For each oPar in ActiveDocument.Paragraphs
    ...<code>
    Set oPar = ActiveDocument.Paragraphs(i)
    ...<code>
    i = i +1
Next oPar
Reply With Quote