1 person found this helpful
The problem is occurring because you're effectively removing the paragraph end by replacing the entire contents of the paragreaph. You want to use the Characters collection and the ItemByRange method so that you can leave the paragraph end untouched.
I'm pretty sure it would look something like this though I haven't tested this:
Set SChar = Paragraph1.Characters(1)
Set EChar = Paragraph1.Characters(-2) 'giving you the 2nd to last character.
Set TxtToDel = Paragraph1.Characters.ItemByRange(SChar, EChar).
Then you can set Paragraph1.InsertionPoints(1).Contents to the new text.
If the ItemByRange doesn't work you can always loop through the character collectoin and delete all but the last characters in the paragraph.
Thanks alot Ken.
It doesn't quite work if I use your example as it is, because I can have paragraphs without any text in them, and also without a Chr(13) at the end (last paragraph within a table cell), but you surely guided me onto the right track.
I ended up with the following code, which seems to work for all cases, including empty paragraphs, and paragraphs without the Chr(13):
If Right(Paragraph.Contents, 1) = Chr(13) Then
Do Until Paragraph.Characters(1).Contents = Chr(13)
Paragraph.InsertionPoints(1).Contents = NewContents
Paragraph.Contents = NewContents
It may not be the most efficient way of doing it (deleting one character at a time), but it works.