ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to Force Response in Dialog Box (https://www.excelbanter.com/excel-programming/287431-macro-force-response-dialog-box.html)

JenReyn

Macro to Force Response in Dialog Box
 
Is there a way to force the response in a dialog box
within a VBA macro?

For example, I need to perform a save as and overwrite an
existing file. Of course, excel knows the file exists and
asks if you want to perform the overwrite. Since multiple
users will be performing the macro, I want to be able to
force them to do the overwrite.

Any ideas?

Thanks!
JenReyn

Rob van Gelder[_4_]

Macro to Force Response in Dialog Box
 
JenReyn,

Setting DisplayAlerts set to False will skip the overwrite warning.

Sub testit()
Dim blnTemp As Boolean

blnTemp = Application.DisplayAlerts
Application.DisplayAlerts = False
ThisWorkbook.SaveAs "C:\T\test.xls"
Application.DisplayAlerts = blnTemp
End Sub

Rob


"JenReyn" wrote in message
...
Is there a way to force the response in a dialog box
within a VBA macro?

For example, I need to perform a save as and overwrite an
existing file. Of course, excel knows the file exists and
asks if you want to perform the overwrite. Since multiple
users will be performing the macro, I want to be able to
force them to do the overwrite.

Any ideas?

Thanks!
JenReyn





All times are GMT +1. The time now is 10:07 AM.

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