M
mjlaali
Hi,
how to detect that the end of a range is also end of a paragraph?
how to detect that the end of a range is also end of a paragraph?
macropod said:Hi Graham,
Not quite! Try selecting the 'paragraph mark' that defines the end of a
table cell, then run the following macro:
Sub Test()
'Graham's test
MsgBox Selection.Characters.Last = Chr(13)
'Macropod's test
MsgBox Asc(Selection.Characters.Last) = 13
End Sub
--
Cheers
macropod
[Microsoft MVP - Word]
Graham Mayor said:There are several ways including:
Test whether the range and the last paragraph in the range have the same
end eg
If oRng.End = oRng.Paragraphs.Last.Range.End Then
'the range end is also a paragraph end.
End If
or see what the last character of the range is e.g.
If oRng.Characters.Last = Chr(13) Then
'the range end is also a paragraph end
End If
or
If oRng.Characters.Last = vbCr Then
'the range end is also a paragraph end
End If
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham said:It could be argued that the table cell end marker is not a paragraph
mark, but I take your point.
macropod said:Hi Graham,
Not quite! Try selecting the 'paragraph mark' that defines the end
of a table cell, then run the following macro:
Sub Test()
'Graham's test
MsgBox Selection.Characters.Last = Chr(13)
'Macropod's test
MsgBox Asc(Selection.Characters.Last) = 13
End Sub
--
Cheers
macropod
[Microsoft MVP - Word]
Graham Mayor said:There are several ways including:
Test whether the range and the last paragraph in the range have the
same end eg
If oRng.End = oRng.Paragraphs.Last.Range.End Then
'the range end is also a paragraph end.
End If
or see what the last character of the range is e.g.
If oRng.Characters.Last = Chr(13) Then
'the range end is also a paragraph end
End If
or
If oRng.Characters.Last = vbCr Then
'the range end is also a paragraph end
End If
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Hi,
how to detect that the end of a range is also end of a paragraph?