Page layout in a form - Word XP

L

Larry

I have a form that I have protected so that no one can change it. However,
people may need to change the printer tray from which it pulls the paper. Is
there a way to do this as Page Setup is disabled in protected forms?
 
J

Jay Freedman

I have a form that I have protected so that no one can change it. However,
people may need to change the printer tray from which it pulls the paper. Is
there a way to do this as Page Setup is disabled in protected forms?

You'll need a macro that unprotects the document, displays the Page
Setup dialog, applies only the printer tray assignment, and reprotects
the document. See http://www.gmayor.com/installing_macro.htm for how
to use the following code:

Public Sub PaperTray()
' if the form has a password:
'Dim strPWD As String
'strPWD = "g83Re7ghY9eh" or whatever it is

' unprotect form
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect ' Password:=strPWD
End If

Dim dlg As Dialog
Set dlg = Dialogs(wdDialogFilePageSetup)

With dlg
' display the dialog, but use only the trays
If .Display = -1 Then
ActiveDocument.PageSetup.FirstPageTray = .FirstPage
ActiveDocument.PageSetup.OtherPagesTray = .OtherPages
End If
End With

' reprotect form
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True ', Password:=strPWD
End Sub

If you have trouble getting the trays to be set correctly by this
macro, see the article at
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=101 for a
more capable method.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
Top