Macro to Force Response in Dialog Box

  • Thread starter Thread starter JenReyn
  • Start date Start date
J

JenReyn

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
 
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
 
Back
Top