MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Opening Password Protected Excel Worksheets

Posted by krazykoolkris on August 16, 2000 11:20 PM

Hi ,
I am a newbie in VBA programming !!
i was trying to open a password protected xls file in VB !!
But i failed hopelessly !!
Do u have any ideas about it !!!
I assume that i dont know the password !!!
Looking forward to something useful !!!!!!

Posted by Ryan on August 17, 0100 9:01 AM


If you don't know the password you can't open the file. If you do know the password then you can using code this way

Sub OpenBook

Workbooks.Open "C:\Path\password.xls",Password:="password"

End Sub

Hope this helps!