A correction
Public Function Lastline() As Boolean
Lastline = (ActiveDocument.Range.End -
ActiveDocument.Bookmarks("\Line").End) <= 1
End Function
This function returns true in the following circumstances
- The cursor is an insertion point, positioned somewhere on the last line of
the document, or
- The cursor is a solid selection whose start is somewhere on the last line
of the document.
The key to the function is that if the cursor is on the last line of the
document, the \Line built-in bookmark is marking the whole of the last line,
usually excluding the final paragraph mark. Therefore, you can compare its
End property with the end of the document itself to find out if the cursor
is on the last line.
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition
www.classicvb.org