ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatically respond to message box appearing within a VBA macro (https://www.excelbanter.com/excel-programming/324048-automatically-respond-message-box-appearing-within-vba-macro.html)

Daniel75

Automatically respond to message box appearing within a VBA macro
 
Within a macro routine I am creating a .prn file and saving over an exisiting
file. Every morning this macro runs and a prompt appears asking if I am sure
I want to overwrite the existing file. The user must click "Ok" in order for
the routine to continue. Is there some syntax in which the macro will
automatically answer the msg box?

MikeW[_2_]

Automatically respond to message box appearing within a VBA macro
 
try this:
insert:
Applictaion.DisplayAlerts = false
at the star of your code then
Application.DisplayAlerts = true
just before the end sub statement

Mike

-----Original Message-----
Within a macro routine I am creating a .prn file and

saving over an exisiting
file. Every morning this macro runs and a prompt appears

asking if I am sure
I want to overwrite the existing file. The user must

click "Ok" in order for
the routine to continue. Is there some syntax in which

the macro will
automatically answer the msg box?
.


Trevor Shuttleworth

Automatically respond to message box appearing within a VBA macro
 
try:

Application.DisplayAlerts = False
'
' your code
'
Application.DisplayAlerts = True

Regards

Trevor


"Daniel75" wrote in message
...
Within a macro routine I am creating a .prn file and saving over an
exisiting
file. Every morning this macro runs and a prompt appears asking if I am
sure
I want to overwrite the existing file. The user must click "Ok" in order
for
the routine to continue. Is there some syntax in which the macro will
automatically answer the msg box?




Daniel75

Automatically respond to message box appearing within a VBA macro
 
MikeW and Trevor Shuttle, you both answered the question wonderfully.
Thanks, you saved 5 keystrokes performed every morning!

"Daniel75" wrote:

Within a macro routine I am creating a .prn file and saving over an exisiting
file. Every morning this macro runs and a prompt appears asking if I am sure
I want to overwrite the existing file. The user must click "Ok" in order for
the routine to continue. Is there some syntax in which the macro will
automatically answer the msg box?



All times are GMT +1. The time now is 11:11 PM.

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