Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

vba run-time error 4605.

516 views
Skip to first unread message

Dave Pearson

unread,
Mar 26, 2003, 6:42:49 AM3/26/03
to
I have been getting the following error message while using Word XP.

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

Peter Hewett

unread,
Mar 26, 2003, 7:20:15 AM3/26/03
to
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:

Dave Pearson

unread,
Mar 27, 2003, 8:51:04 AM3/27/03
to
Hi Peter,

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>...

Peter Hewett

unread,
Mar 27, 2003, 4:12:40 PM3/27/03
to
Hi Dave

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

Dave Pearson

unread,
Mar 28, 2003, 11:54:24 AM3/28/03
to
Many Thanks 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...

0 new messages