prevent saveAs dialog

K

keithb

How can I execute saveAs without getting a dialog box asking if it is ok to
overwrite the file? I am trying to save in a specific format and if I
undertand correctly, the "FileFormat" parameter is not available for a
straight save.

Thanks,

Keith
 
C

Chip Pearson

Keith,

There are two ways to do this. The first way is to Kill the file
and then do a Save As. E.g.,

On Error Resume Next
Kill "H:\Book2.xls"
On Error GoTo 0
ThisWorkbook.SaveAs Filename:="H:\book2.xls"

Or, you can turn off alerts, do the save, then turn alerts back
on.

Application.DisplayAlerts = False
ThisWorkbook.SaveAs Filename:="H:\Book2.xls"
Application.DisplayAlerts = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top