Automate Opening PW Protected Workbook


Posted by doug on March 01, 2001 1:49 PM

Does anyone know how to automate the opening of a password protected excel file so that it doesn't ask for the pw. I do have the password and if needed can put this in the code. Can it be done?



Posted by Roger Redhat on March 04, 2001 12:09 PM

This code is what you need.

Sub OpenProtectedWorkbook()
Application.Workbooks.Open "C:\temp\book2.xls", , , , "password"
End Sub

Regards,
Rog.