ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   prevent saveAs dialog (https://www.excelbanter.com/excel-programming/339643-prevent-saveas-dialog.html)

keithb

prevent saveAs dialog
 
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



Chip Pearson

prevent saveAs dialog
 
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




"keithb" wrote in message
...
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





All times are GMT +1. The time now is 01:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com