Counting pages

J

JulieT

Hi - trying to figure out how I can say:

If Pages.count = >1 then
msgbox ("you need more than one page") and exit sub

I want my macro to give the user a message and exit the
routine if they don't have 2 or more pages. I've
searched, and now I'm asking for help. Thank you
 
G

Greg Maxey

Julie,

Something like:

Sub PageCount()

Dim oPageCount As Long

oPageCount = ActiveDocument.ComputeStatistics(wdStatisticPages)
If oPageCount < 2 Then
MsgBox "This document must contain two or more pages.", vbOKOnly,
"Insufficient Page Count"
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top