?
Solved

File save as - replace existing file

Posted on 2008-06-12
3
Medium Priority
?
855 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
mvidas earned 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Suggested Courses
Course of the Month14 days, 11 hours left to enroll

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