Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default error 1004 Method SaveAs of Workbook failed

I'm trying to save a backup copy of a macro-created workbook as a CSV. The
workbook has a single sheet. This line fails with a 1004 error:

oExcelApp.activeworkbook.SaveAs filename:="L:\aTest\Sent\Trades_" &
Format(date, "yyyy-mm-dd"), FileFormat:=xlCSV, CreateBackup:=False

Anyone have any ideas? When I try a SaveAs manually I get a dialog -- if
this is the problem, how can I avoid this?

Maury
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default error 1004 Method SaveAs of Workbook failed

good bet you are using Late Binding. As such, the constant xlCSV would have
a value of zero when you want to pass a value of

6. So do that explicitly

oExcelApp.activeworkbook.SaveAs _
filename:="L:\aTest\Sent\Trades_" & _
Format(date, "yyyy-mm-dd"), _
FileFormat:=6, _
CreateBackup:=False

--
Regards,
Tom Ogilvy

"Maury Markowitz" wrote in
message ...
I'm trying to save a backup copy of a macro-created workbook as a CSV. The
workbook has a single sheet. This line fails with a 1004 error:

oExcelApp.activeworkbook.SaveAs filename:="L:\aTest\Sent\Trades_" &
Format(date, "yyyy-mm-dd"), FileFormat:=xlCSV, CreateBackup:=False

Anyone have any ideas? When I try a SaveAs manually I get a dialog -- if
this is the problem, how can I avoid this?

Maury



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default error 1004 Method SaveAs of Workbook failed

Geez Tom, I think I'm up to owing you a bottle of something nice by this
point. Name yer poison! (seriously)

Maury

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 1004: Calculate Method of Range Class Failed Dan Winterton[_2_] Excel Programming 6 October 13th 05 10:19 PM
Error 1004 Method 'Add'of Object Sheets failed ExcelMonkey[_190_] Excel Programming 10 March 29th 05 01:52 PM
RT Error 1004, Select method of worksheet class failed Dana Sherbondy Excel Programming 2 October 1st 04 03:55 PM
Error 1004: Method 'Cells' of object '_Global' failed LT Excel Programming 2 October 31st 03 04:47 PM
Error Excel: 1004 SaveAs method of Workbook class failed sebastien Excel Programming 0 August 13th 03 09:59 AM


All times are GMT +1. The time now is 08:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"