Solved

File save as - replace existing file

Posted on 2008-06-12
3
849 Views
Last Modified: 2010-04-21
I my existing macro I have to save the active worksheet as a csv.  The csv will always exist in the directory which I am saving it to.  Is there a parameter in the saveas command that will automatically answer the replace file question?
ActiveWorkbook.SaveAs Filename:="C:\my documents\Costing.csv", FileFormat:=xlCSV, CreateBackup:=False

Open in new window

0
Comment
Question by:ilrosebud26
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
mvidas earned 50 total points
ID: 21772865
Hi rosebud,

If you toggle DisplayAlerts before and after the saveas line, it shouldn't prompt you.

Matt
Application.DisplayAlerts = False

ActiveWorkbook.SaveAs Filename:="C:\my documents\Costing.csv", FileFormat:=xlCSV, CreateBackup:=False

Application.DisplayAlerts = True

Open in new window

0
 

Author Closing Comment

by:ilrosebud26
ID: 31466709
Thank you for your quick response.  I am sorry to ask something so simple but now I know!
0
 
LVL 35

Expert Comment

by:mvidas
ID: 21773042
Not a problem! It is a useful thing to use remove any prompt you get (saveas, erase sheet, etc). Almost as useful as turning off ScreenUpdating to make things run smoother :) Let me know if you need anything else
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now