Creating Word PAge Limits

G

Guest

I'm currently developing an application for institution to use online. How
do I format the Word document to a certain page limit. For example, I do not
want the document to be larger then 10 oages after the user has adder their
data. I'm assuming that this is impossible but I thought I would check.
 
G

Graham Mayor

I don't think what you require is possible, however you could perhaps warn
the users?

Intercept the FileSave/Save As commands in the document template eg - which
will not allow a user to save a document longer than 10 pages.

Sub FileSave()
On Error GoTo UserCancelled:
If ActiveDocument.ComputeStatistics(Statistic:=wdStatisticPages) > 10 Then
MsgBox "This document is too long and has not been saved." & vbCr & _
"Reduce the document size to 10 pages or less, and save again", vbCritical,
"Error!"
Exit Sub
End If
ActiveDocument.Save
Exit Sub
UserCancelled:
MsgBox "Cancelled!", vbCritical, ""
End Sub

Sub FileSaveAs()
On Error GoTo UserCancelled:
If ActiveDocument.ComputeStatistics(Statistic:=wdStatisticPages) > 10 Then
MsgBox "This document is too long and has not been saved." & vbCr & _
"Reduce the document size to 10 pages or less, and save again", vbCritical,
"Error!"
Exit Sub
End If
Dialogs(wdDialogFileSaveAs).Show
Exit Sub
UserCancelled:
MsgBox "Cancelled!", vbCritical, ""
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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