Handling message boxes in code

  • Thread starter Thread starter Need Help Fast!
  • Start date Start date
N

Need Help Fast!

Hi!
I've created files for different people in my department
in excel in which they enter data. When they go to save
their files, they are prompted with a message box asking
if they want to update a master file with their data.

I have now created a wrap-up file that reads from each
persons files and makes minor changes to it as it extracts
data. Is there any way to code the macro so that it
automatically chooses 'No' when that message box pops up?

Any help would be very much appreciated.
 
If you mean that the message will still appear but the NO
button is the one taking focus, then include
+vbDefaultButton2
in the Buttons option, e.g
MsgBox "Some message", vbYesNo + vbDefaultButton2

Kevin Beckham
 
application.displayalerts=false
your input box
application.displayalerts=true
 
If you are going to modify the code, why not take out the code that displays
the msgbox?
 
Oh, I think I get it now. You want to do this in your wrap-up macro.

Assuming the msgbox is triggered by an event

Application.EnableEvents = False
' open and process the file
' close it
Application.EnableEvents = True
 
Thanks very much! I'll try it out!
-----Original Message-----
application.displayalerts=false
your input box
application.displayalerts=true

--
Don Guillett
SalesAid Software
(e-mail address removed)



.
 
Application.DisplayAlerts has no effect on an input or msgbox displayed by
code. I am not aware of a built in alert that asks to update a master
file.
 

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

Back
Top