G
Greg Maxey
Perhaps my previous post was too involved so I will try again.
I have a document with an open password and a modify password. If I open
that document with the normal user interface and type an incorrect password
in either the Password open dialog or the Password modify dialog and then
click "OK" the applcation issues a notification of and incorrect password.
The document can not be opened and editied until both passwords are entered
correctly.
If I try to open that same document using the following code then the error
handler traps the incorrect password in the Password open dialog but when I
enter an incorrect password in the Password modify dialog and click OK
nothing happens. There is no error generated, the dialog remains in focus,
I can click on OK repeatedly and still nothing happens.
If I click "Cancel" in the Password modify dialog then an error is
generated. Also if I enter the wrong password, click OK, then enter the
correct password and click "Ok" the file opens but a new error 5485 is
generated.
Sub ScratchMacroII()
Dim oDoc As Word.Document
On Error GoTo Err_Password
Set oDoc = Documents.Open("C:\Test.doc") 'A document password protected for
opening and editing.
Exit Sub
Err_Password:
MsgBox Err.Number
End Sub
Can anyone duplicate this behaviour and offer an explanation?
Thanks.
I have a document with an open password and a modify password. If I open
that document with the normal user interface and type an incorrect password
in either the Password open dialog or the Password modify dialog and then
click "OK" the applcation issues a notification of and incorrect password.
The document can not be opened and editied until both passwords are entered
correctly.
If I try to open that same document using the following code then the error
handler traps the incorrect password in the Password open dialog but when I
enter an incorrect password in the Password modify dialog and click OK
nothing happens. There is no error generated, the dialog remains in focus,
I can click on OK repeatedly and still nothing happens.
If I click "Cancel" in the Password modify dialog then an error is
generated. Also if I enter the wrong password, click OK, then enter the
correct password and click "Ok" the file opens but a new error 5485 is
generated.
Sub ScratchMacroII()
Dim oDoc As Word.Document
On Error GoTo Err_Password
Set oDoc = Documents.Open("C:\Test.doc") 'A document password protected for
opening and editing.
Exit Sub
Err_Password:
MsgBox Err.Number
End Sub
Can anyone duplicate this behaviour and offer an explanation?
Thanks.