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
Solved

Macro - Saving file auto select YES to file already exists?

Posted on 2014-03-27
2
1,273 Views
Last Modified: 2014-03-27
The following macro will take everything in one Excel file, convert it to CSV format and put it into another Excel file for an AutoCad function we need but we want to code it so it will just choose the two YES prompts that come up for Windows asking if we want to replace and overwrite.

Any assistance offered would be greatly appreciated.
Sub write_csv_xls()
'
' write_csv_xls Macro
' Writes the CSV file then Saves the XLSM file
'

'
    ActiveWorkbook.SaveAs Filename:= _
        "F:\Cadd\Blocks\New Titleblock\Title_Frame_Register.csv", FileFormat:=xlCSV, _
        CreateBackup:=False
    ActiveWorkbook.SaveAs Filename:= _
        "F:\Cadd\Blocks\New Titleblock\Title_Frame_Register.xlsm", FileFormat:= _
        xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub
0
Comment
Question by:regsamp
2 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 500 total points
ID: 39959689
Try framing your code with

application.displayalerts=false

'your code

application.displayalerts=true

Open in new window


This should disable the warnings while you save, assuming you're running this macro from within excel and not in a vb script batch.

Thomas
0
 

Author Comment

by:regsamp
ID: 39959720
It is an Excel Macro. Okay, I will try it. Thank you.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
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…

808 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