Try adding .xls to each of these lines:
Workbooks("SYS01 Report").Saved = True
Workbooks("SYS01 Report").Close
Workbooks("SYS01 Report.xls").Saved = True
Workbooks("SYS01 Report.xls").Close
There's a windows setting that allows users to hide/show extensions. To be
careful, you can always include the extension and it'll work no matter the what
the user chose for that setting.
hlam wrote:
>
> I got an Out of Range error closing a workbook using VBA on one machine but
> not the other. Can any one help?
>
> fName = Left(ThisWorkbook.Path, pos) & "SYS01 Report.xls"
> Workbooks.Open Filename:=fName
> Sheets(1).Select
> Sheets(1).Copy Before:=Workbooks("SYS01 Program.xls").Sheets(1)
> Workbooks("SYS01 Report").Saved = True
> Workbooks("SYS01 Report").Close ... this is the code gets the error
> ThisWorkbook.Sheets(1).Name = "CTL"
--
Dave Peterson
|