password help


Posted by steve w on September 06, 2001 12:51 PM

What I'm trying to do is open a workbook that is file protected with a macro. I know the password but I want to open it with code.
Anyone know how to do this I keep getting errors with this code.

thanks steve w

Sub Macro2()
Workbook.Open Filename:="C:\My Documents\333.xls", FileFormat:= _
xlNormal, password:="123", WriteResPassword:="abc"
End Sub



Posted by Dax on September 06, 2001 2:26 PM

Sub Macro2()
Workbooks.Open Filename:="C:\My Documents\333.xls", password:="123", WriteResPassword:="abc"
End Sub

Format is only for text files and you had Workbook not Workbooks.

Regards,
Dax.