Ok, I posted my code two days ago. The forms toolbar padlock icon prompts for
a password but my code does not work. If I go to another computer with word
2000 and open the exact same document, it works. If I open with word 2003, it
doesn't.
Peter
> Public Sub URS_Unlock()
> On Error GoTo Errorhandler
[quoted text clipped - 13 lines]
>
> > Can you post your code?
Graham Mayor - 28 Sep 2007 08:45 GMT
I no longer have access to Word 2000 to check, but Word 2003 works as you
indicate. The vba help has not been updated (and still has not in Word 2007)
and so is misleading. It does however say
"If a password is required in a procedure, request the password from the
user, store it in a variable, and then use the variable in your code"
so
Public Sub URS_Unlock()
Dim sPassword As String
sPassword = ""
Start:
On Error GoTo Errorhandler:
With ActiveDocument
If .ProtectionType <> wdNoProtection Then
.Unprotect (sPassword)
End If
End With
Errorhandler:
If Err.Number = 5485 Then
sPassword = InputBox("Enter password", "Unprotect")
GoTo Start:
End If
End Sub
should work with either version

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Ok, I posted my code two days ago. The forms toolbar padlock icon
> prompts for a password but my code does not work. If I go to another
[quoted text clipped - 24 lines]
>>> Message posted via OfficeKB.com
>>> http://www.officekb.com/Uwe/Forums.aspx/word-programming/200709/1