T
Tony
I'm trying to export the results of a query to an Excel
spreadsheet. Both TransferSpreadsheet and OutputTo work
fine for that. I can also export to a pre-exisiting
workbook using these methods.
But on the second time I export to the same workbook, my
first export is overwritten. I can avoid this by changing
the name of the spreadsheet (or tab) in the Workbook. But
I have not been successful in doing this in VB code. I've
used the following code:
Sheets("sheet1").Name = "test"
But get the error message below:
Error is Run time error 1004
Method 'Sheets' of Global_Failed
spreadsheet. Both TransferSpreadsheet and OutputTo work
fine for that. I can also export to a pre-exisiting
workbook using these methods.
But on the second time I export to the same workbook, my
first export is overwritten. I can avoid this by changing
the name of the spreadsheet (or tab) in the Workbook. But
I have not been successful in doing this in VB code. I've
used the following code:
Sheets("sheet1").Name = "test"
But get the error message below:
Error is Run time error 1004
Method 'Sheets' of Global_Failed