However, in looking at these programmatically, how can you tell them
apart?
You can't if what you're looking at is range.text, because it's nothing
like a complete representation of what is in the range, and as you say,
both "paragraph marker character" and "CR character" come up as 13.
You would see the difference if you looked at either range.XML or
range.WordOpenXML, (you would see that - roughly speaking, a "paragraph"
is enclosed in <w
> and </w
>, but a "CR character" is represented by
a <w:cr/> within the "run" (<w:r> </w:r>) that contains the following
piece of text ( <w:t> </w:t> )
Unfortunately, if you use that approach then you would have to find ways
to ignore all the other stuff in there that you're not actually
interested in.
Without resorting to looking at XML, you could try incorporating
something along the following lines
Sub check13()
Dim i As Integer
Dim c As Word.Characters
Set c = Selection.Range.Characters
For i = 1 To c.Count
If AscW(c(i).text) = 13 Then
If c(i).Paragraphs(1).Range.End = c(i).End Then
Debug.Print CStr(i) & ": this 13 is a paragraph marker"
Else
Debug.Print CStr(i) & ": this 13 is not a paragraph marker"
End If
Set ce = Nothing
Else
Debug.Print CStr(i) & ": " & AscW(c(i))
End If
Next
Set c = Nothing
End Sub
Peter Jamieson
http://tips.pjmsn.me.uk