vba run-time error 4605 the method or property is not available
because the document is a protected document.
I have a few Protected Documents which I ahve on a menu. Also on this
menu I ahve additional print Macro's, which allows me to Print to
either LetterHead or Plain paper.
These all worked fine with Word 97, but they are now giving me the
above error with XP.
I've tried the MS site for answers, but cannot find anything.
Can anyone help?
Cheers
Dave
You don't say what you are actually doing at the time you get the error and
what the actual code is that's throwing the error. Post again with this
additional information.
Cheers - Peter
rek...@totalise.co.uk (Dave Pearson) wrote in
news:3d430180.03032...@posting.google.com:
I get the error when I run the following.
Sub Lethead()
With ActiveDocument.PageSetup
.FirstPageTray = wdPrinterLowerBin
.OtherPagesTray = wdPrinterDefaultBin
End With
ActiveDocument.PrintOut
End Sub
Sub copyonly()
With ActiveDocument.PageSetup
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
End With
ActiveDocument.PrintOut
End Sub
These are attached to buttons on a menu, which are used instead of the
standard File...Print.
They are standard documents that are protected with the built in
document protection.
This work fine under Word97, but I get the error under Word XP.
Regards
Dave.
Peter Hewett <Nos...@xtra.co.nz> wrote in message news:<Xns934B334...@207.46.248.16>...
If you attempt the same thing manually you'll see that the File/Page Setup
option is disabled! You can't change the page layout of a protected form.
I've modified them to unprotect the form and then reprotect it, if
necessary:
Sub Lethead()
Dim boolProtect As Boolean
With ActiveDocument
' Unprotect document if necessary
If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
.Unprotect
boolProtect = True
End If
With .PageSetup
.FirstPageTray = wdPrinterLowerBin
.OtherPagesTray = wdPrinterDefaultBin
End With
.PrintOut
' Reprotect document if necessary
If boolProtect Then .Protect wdAllowOnlyFormFields, True
End With
End Sub
Sub copyonly()
Dim boolProtect As Boolean
With ActiveDocument
' Unprotect document if necessary
If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
.Unprotect
boolProtect = True
End If
With ActiveDocument.PageSetup
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
End With
.PrintOut
' Reprotect document if necessary
If boolProtect Then .Protect wdAllowOnlyFormFields, True
End With
End Sub
These procedures will now work correctly with both protected forms and
"normal" documents.
I hope this helps + Cheers - Peter
This worked a treat. I was thinking it was something more complicated.
I didn't even notice that page setup was disabled, I was concentrating on
the print bit.
Many Thanks again.
Dave
"Peter Hewett" <Nos...@xtra.co.nz> wrote in message
news:Xns934C5D7F...@207.46.248.16...