Hi,
I have written the following code to open a password protected file. But it gives a 1004 error. I can’t see what I have done wrong. Any ideas would be much appreciated.
Sub Cts()
Dim wb As Workbook
Dim receiver As String
receiver = "C:\Documents and Settings\Desktop\Receiver.xls"
Set wb = Application.Workbooks.Open("receiver", Password:="password", WriteResPassword:="password")
With wb.Sheets("ST Comment Results")
End With
End Sub
I have written the following code to open a password protected file. But it gives a 1004 error. I can’t see what I have done wrong. Any ideas would be much appreciated.
Sub Cts()
Dim wb As Workbook
Dim receiver As String
receiver = "C:\Documents and Settings\Desktop\Receiver.xls"
Set wb = Application.Workbooks.Open("receiver", Password:="password", WriteResPassword:="password")
With wb.Sheets("ST Comment Results")
End With
End Sub