Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Excel Errors / May 2006

Tip: Looking for answers? Try searching our database.

Excel report error (VBA)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dirk rogers - 25 May 2006 21:56 GMT
I am trying to save a record in a CSV file.  Whenever I run the macro, I get
an error:

Run-time error '1004'
Method 'SaveAs' of object '_Workbook' failed

My code for this is:

Sub SaveCSV()
   Property = Range("[Control.xls]Info!B2").Value
   TodaysDate = Format(Now, "dd-mm-yy")
   ActiveWorkbook.SaveAs Filename:="C:\Export\Files\" & Property &
TodaysDate & ".csv", _
   FileFormat:=xlCSV, CreateBackup:=False
   NewSaveName = Property & TodaysDate & ".csv"
End Sub

Any ideas on how to fix this?  Help much appreciated.
Signature

Thanks, Dirk

Chip Pearson - 30 May 2006 02:18 GMT
Your code worked fine for me as long as the folder
C:\Export\Files exists. Are you sure that folder exists?

Signature

Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

>I am trying to save a record in a CSV file.  Whenever I run the
>macro, I get
[quoted text clipped - 16 lines]
>
> Any ideas on how to fix this?  Help much appreciated.
dirk rogers - 30 May 2006 23:21 GMT
Yeah, I finally figured that one out after hours of frustration.  Thanks for
your reply!
Signature

Thanks, Dirk

> Your code worked fine for me as long as the folder
> C:\Export\Files exists. Are you sure that folder exists?
[quoted text clipped - 19 lines]
> >
> > Any ideas on how to fix this?  Help much appreciated.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.