Document Protection

K

Karen

Using Access 2003 and Word 2003

I have a small Access app which opens a Word template and inserts database
info into the new Word doc. The Word doc is protected and I use this little
snippet of VBA to unprotect the Word doc.

If objWord.activedocument.ProtectionType <> wdNoProtection Then
objWord.activedocument.Unprotect Password:=strpassword
End If

Life was good and all users were happy UNTIL a User who had Word 2002 vice
Word 2003 generates an error when Access tries to create the Word doc. The
error message is to the effect that the document cannot be unprotected since
it is already unprotected.

This only pops an error with the Word 2002 person.

Anyone know if there was some fundamental change between Word 2002 and Word
2003 that may explain my VBA error?
 
J

Jezebel

Rather than worry about the cause, put in an error-handler. By the sounds of
it, it will be sufficient just to ignore the error...

If objWord.activedocument.ProtectionType <> wdNoProtection Then
on error resume next
objWord.activedocument.Unprotect Password:=strpassword
on error goto 0
End If
 

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