I'm not familiar with sendkey's in excel 97 so I hope someone is able
to help me with this. I looked around and came up with (someone
else's code, did not find author's name):
Sub UnlockVBAProject()
With Application
.SendKeys "%{F11}", True ' VBE
.SendKeys "^r", True ' Set focus to Explorer
.SendKeys "{TAB}", True ' Tab to locked project
.SendKeys "~", True ' Enter
.SendKeys "password" ' project password
.SendKeys "~", True ' Enter
End With
Application.Run "ChangePW"
ActiveWorkbook.Save
reprotect the vba?
End Sub
I think when I tried to run this, it input the "password" right into a
cell in excel.
Thankyou,
Daniel
If you ran it from the Visual Basic Editor it would have done.
(Alt+F11 would take you back to Excel)
I don't believe you can avoid the user seeing the VB editor window at
least briefly while unprotecting the project.
Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup