ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatic response to message box? (https://www.excelbanter.com/excel-programming/277043-automatic-response-message-box.html)

Benjamin[_3_]

Automatic response to message box?
 
If every time I run a macro I get a typical message box,
can I program it to automatically respond to it?

For example, if within my macro I close a file and it asks
me if I want to save the changes, can my macro
automatically respond to the message box saying NO?

Harald Staff[_5_]

Automatic response to message box?
 
No. (Yes, ok, with SendKeys, but that is extremely unreliable.) The trick is
to make the boxes NOT appear at all. That's done with

Application.DisplayAlerts = False

But then you'd better make sure your code knows what it does, like close
without saving changes, overwriteexisting file, things like that.

--
HTH. Best wishes Harald
Excel MVP
Followup to newsgroup only please

"Benjamin" skrev i melding
...
If every time I run a macro I get a typical message box,
can I program it to automatically respond to it?

For example, if within my macro I close a file and it asks
me if I want to save the changes, can my macro
automatically respond to the message box saying NO?





All times are GMT +1. The time now is 03:47 AM.

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