It can be simpler than that. This will do the trick
Public Function Lastline() As Boolean
Lastline = ActiveDocument.Range.End = ActiveDocument.Bookmarks("\Line").End
End Function

Signature
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
> Hi
>
[quoted text clipped - 25 lines]
> Win XP, Office 2003
> "red.sys" & Chr$(64) & "t-online.de"
Helmut Weber - 18 Jul 2005 17:53 GMT
Hi Jonathan,
I get an error:
"Function call of left-hand side of assignment
must return variant or object"
Hmm...
Greetings from Bavaria, Germany
Helmut Weber, MVP, WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
Chuck Henrich - 18 Jul 2005 18:20 GMT
Hi Jonathan
Just to clarify:
Lastline = Activedocument.Range.End
will be true if the insertion point is at the end of the document while
Lastline = ActiveDocument.Bookmarks("\Line").End
will be true if the IP is at the end of the current line, yes?
Chuck
> It can be simpler than that. This will do the trick
>
[quoted text clipped - 31 lines]
> > Win XP, Office 2003
> > "red.sys" & Chr$(64) & "t-online.de"
Jonathan West - 18 Jul 2005 18:38 GMT
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.

Signature
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
> It can be simpler than that. This will do the trick
>
[quoted text clipped - 32 lines]
>> Win XP, Office 2003
>> "red.sys" & Chr$(64) & "t-online.de"
Helmut Weber - 19 Jul 2005 12:53 GMT
Hi Jonathan,
great. Live and learn.
Greetings from Bavaria, Germany
Helmut Weber, MVP, WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"