prevent saveAs dialog

  • Thread starter Thread starter keithb
  • Start date Start date
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
 
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
 
Back
Top