Solved

File save as - replace existing file

Posted on 2008-06-12
3
848 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 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

11 Experts available now in Live!

Get 1:1 Help Now