megtoma
09-08-2014, 07:37 AM
Hello,
The below code works when the file zzz.xls is not open but when someone is using the zzz.xls file, I get an error message. Could anyone please help me to change that code so it works no matter if the file is open or closed? I would appreciate your help.
Many thanks,
Workbooks.Open Filename:="\\zzzz\zzz.xls (file://\\zzzz\zzz.xls)", Password:="gold", ReadOnly:=True
With GetObject("\\zzzz\zzz.xls (file://\\zzzz\zzz.xls)")
ThisWorkbook.Sheets("Controls Tracker P3").Range("B6:N205").Value = .Sheets("Examination").Range("C3:O202").Value
ThisWorkbook.Sheets("Controls Tracker P3").Range("O6:O205").Value = .Sheets("Examination").Range("Q3:Q202").Value
.Close 0
End With
End Sub
The below code works when the file zzz.xls is not open but when someone is using the zzz.xls file, I get an error message. Could anyone please help me to change that code so it works no matter if the file is open or closed? I would appreciate your help.
Many thanks,
Workbooks.Open Filename:="\\zzzz\zzz.xls (file://\\zzzz\zzz.xls)", Password:="gold", ReadOnly:=True
With GetObject("\\zzzz\zzz.xls (file://\\zzzz\zzz.xls)")
ThisWorkbook.Sheets("Controls Tracker P3").Range("B6:N205").Value = .Sheets("Examination").Range("C3:O202").Value
ThisWorkbook.Sheets("Controls Tracker P3").Range("O6:O205").Value = .Sheets("Examination").Range("Q3:Q202").Value
.Close 0
End With
End Sub