vba if message box pop up then

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
1,124
Office Version
  1. 365
Platform
  1. Windows
Hi All,

Is there a vba code that can be created to respond to a message box pop up?

I need help on starting this code, for example, if a message box pops up then

'do something.

Please let me know.

Thank you!
Pinaceous
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
A message box is nothing you can respond to. It's just in between.

You could run some code where you check if a condition is met, then respond with a message box and after it was closed run some other code.

May I ask, what exactly are you planning to do?
 
Upvote 0
Yeah, I am also a bit confused by the question, not really understanding what they want to do.
I agree that it would be good if they could clarify it and tell us exactly what it is that they are trying to do.

Note that in VBA code, you can see HOW a user responds to a MsgBox (if they click "Yes" or "No"), and do some action based on that.
But if you are looking for user input, it is better to use an InputBox, i.e. InputBox Function in Excel VBA
 
Upvote 0
Hi Guys!

I'm working with an Excel file, which is providing a message box upon its opening but it remains in the background behind the Excel document and does not come forward, which is causing a lot of confusion to say the least!

Thanks,
Pinaceous
 
Upvote 0
What kind of message box is it?
What does it say?
Is it being generated by VBA code?
If so, please post that code for us.
 
Upvote 0
What kind of message box is it?
What does it say?
Is it being generated by VBA code?
If so, please post that code for us.
Capture.PNG

This is what the message box says above.

It is not being generated by VBA code and I am trying to either bring this message box forward or to do something like minimize the document, so the user can act on this pop-up.

I need help with bringing this message box forward or to act on this pop-up when it appears.
 
Upvote 0
That is odd. Typically those messages pop to the top without you having to do anything.
What is showing up on top of it?
Do you have any automated VBA code that is running when the workbook is opened?
 
Upvote 0
Hi Joe4,

Yes, it is a very odd case.

The document is a vba coded where a generated expected message pop-up will introduce itself to the user.

However, Once the document is enabled, the other message box appears and it stays in the background and the user thinks that the document is frozen.

This doesn't happen all of the time, only when the excel thinks it is opened in the other SharePoint application.

Do you have any suggestions on how I can suppress this message box from happening?

FYI, I've tried:


VBA Code:
Application.DisplayAlerts = False

And Now I'm Exploring this idea:

VBA Code:
CreateObject("Shell.Application").MinimizeAll
'this way the user will see the message box pop-up

Please let me know if you can help!

Thanks,
pinaceous
 
Upvote 0
I have not worked with SharePoint at all, so I don't think I will be anyhelp there.

Is there any event VBA code running when this situation occurs, i.e. Workbook_Change, or one of the Worksheet events?

In which procedures exactly are you trying to place the VBA code you posted?
 
Upvote 0
Hi Joe4,

Is there a way to respond to a pop-up through vba code?

For example,



VBA Code:
If Msgbox pops up then

Please let me know.


Thanks!
pinaceous
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top