Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word VBA - Check for last page

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
Is there VBA code that can be used in MS Word to check if you are currently on the last page of a document? I'm trying to write a module that says

If you are on the last page Then
do something
Else
do something else

Thanks!

--
Mike

Why make it simple and efficient when it can be complex and wonderful?
 
Hi Skip,

One thing - should the code be ActiveDocument.BuiltInDocumentProperties(wdPropertyPages) Also, I should have been more specific in my post... I'm trying to implemet a loop that uses loops if you are not on the last page. It looks like this...

Do
Do While ActiveDocument.BuiltInDocumentProperties(wdPropertyPages) = False
(Do syntax)
Exit Do
Loop
Loop Until ActiveDocument.BuiltInDocumentProperties(wdPropertyPages) = True


Is this correct, because it doesn't seem to be working. When I run it, Word goes into an 'unresponsive' state and I get a popup saying that Word is not responding.

Thanks.

--
Mike

Why make it simple and efficient when it can be complex and wonderful?
 
Nevermind, I figured this one out.

Thanks.

--
Mike

Why make it simple and efficient when it can be complex and wonderful?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top