Solved

File save as - replace existing file

Posted on 2008-06-12
3
851 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

813 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

19 Experts available now in Live!

Get 1:1 Help Now