Automatically respond to message box appearing within a VBA macro

G

Guest

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?
 
M

MikeW

try this:
insert:
Applictaion.DisplayAlerts = false
at the star of your code then
Application.DisplayAlerts = true
just before the end sub statement

Mike
 
T

Trevor Shuttleworth

try:

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

Regards

Trevor
 
G

Guest

MikeW and Trevor Shuttle, you both answered the question wonderfully.
Thanks, you saved 5 keystrokes performed every morning!
 

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