Using two passwords in a macro

K

Ken White

I installed a tremendously benificial macro that allows me to use SpellCheck
in locked forms. We have hundreds of these locked forms. and some of them
have different passwords to lock them. Is it possible to have the macro
recognize at least two passwords?
 
K

Klaus Linke

Ken White said:
I installed a tremendously benificial macro that allows me
to use SpellCheck in locked forms. We have hundreds of
these locked forms. and some of them have different passwords
to lock them. Is it possible to have the macro recognize at least
two passwords?


Hi Ken,

Try them both?

' Ignore error if 1st password is wrong:
On Error Resume Next
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:="Test1"
End If
' So you get an error message
' if the 2nd password still isn't the right one:
On Error GoTo 0
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:="Test2"
End If

Regards,
Klaus
 

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