Macro to Force Response in Dialog Box

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
 
R

Rob van Gelder

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
 

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