w.goodwater
New Member
- Joined
- Aug 17, 2007
- Messages
- 1
I have an .xls with multiple worksheets. I have VB script attempting to save one of the worksheets to a new .xls file. When this is run, I get a "Run-time error '1004': Method 'SaveAs' of object '_Workbook' failed" error. My script outputs data to Sheet1. I can save Sheet1 to the new .xls file without problem. But if I add a new sheet, say, Sheet2, and try to save it to the new file, then I receive the above error. I receive this error if I save to a .csv or .txt file, as well.
The line that causes the error is as follows:
Any thoughts would be appreciated.
The line that causes the error is as follows:
Code:
ActiveWorkbook.SaveAs FileName:=strFilename + ".xls",
FileFormat:=xlExcel4, CreateBackup:=False
Any thoughts would be appreciated.