vba code for opening password protected workbook
Thanks very much, that works a treat.
"Carl Irving" wrote:
Hi Ron, i've copied Dave's code in like you said and added the line with the
write password instruction but it gives me a compile error/syntax error when
i try to run it. This is my code as i currently have it, i have tried putting
brackets and commas etc to separate the 2 password lines, i've even tried
them on the same line but everything returns the compile error.
Thanks
Carl
Sub OpenPassword()
Dim wbk As Workbook
Application.DisplayAlerts = False
Set wbk = Workbooks.Open(Filename:="e:\rota stuff\nick rota template", _
UpdateLinks:=True, _
Password:="united1")
WriteResPassword:="united1")
With wbk
.Save
.Close
End With
Set wbk = Nothing
End Sub
|