I have this code, which is automatically run each day on our server - works fine, until sometimes it fails as the file appears to be already in use by "admin" and I assume therefore the macro doesn't know to press "read only"
The file being opened read only doesn't cause any issues.
Sub Open8050()
ChDir "Y:\Data Files\Sales"
Workbooks.Open Filename:="Y:\Data Files\Sales\8050 Report.xlsx"
ChDir "Y:\Data Files\Flash"
Workbooks.Open Filename:="Y:\Data Files\Flash\Flash Data.xlsx", UpdateLinks _
:=0
ActiveWorkbook.Save
ActiveWindow.Close
Workbooks("8050 Report.xlsx").Close
End Sub
Any pointers on the best way to handle this would be great - the spreadsheets simply open, update, and I run a further macro that creates a table and saves the file somewhere else.
My code probably isn't the greatest but it works apart from this issue
TIA
The file being opened read only doesn't cause any issues.
Sub Open8050()
ChDir "Y:\Data Files\Sales"
Workbooks.Open Filename:="Y:\Data Files\Sales\8050 Report.xlsx"
ChDir "Y:\Data Files\Flash"
Workbooks.Open Filename:="Y:\Data Files\Flash\Flash Data.xlsx", UpdateLinks _
:=0
ActiveWorkbook.Save
ActiveWindow.Close
Workbooks("8050 Report.xlsx").Close
End Sub
Any pointers on the best way to handle this would be great - the spreadsheets simply open, update, and I run a further macro that creates a table and saves the file somewhere else.
My code probably isn't the greatest but it works apart from this issue
TIA