vba if message box pop up then

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
1,113
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
 
I have never heard of such a thing.
I am not aware of any event that waits and watches for that.

If you answer the last two questions from my last post, there is a possibility that we may be able to do something to affect the behavior a little bit (depending on what the answers to those questions are).
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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?

What is showing up on top of it?
Microsoft Excel as you can see here.

Capture1.JPG


Do you have any automated VBA code that is running when the workbook is opened?
I do have an automated VBA message box that appears, once the document is enabled that welcomes the user.


Hope these were the two questions you needed answered but if not please let me know.

Thank you,
pinaceous
 
Upvote 0
I thought the issue was the following:
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!

So I was trying to see if there is any VBA running at the same time which would take precedence over it, and maybe that is why it is getting pushed to the back.
If you disable all VBA code, does that message box still get pushed to the back?

What relation does the document named in that message box have with your current workbook?
Are they linked?
Do you have VBA code in the current workbook trying to open that other workbook?
 
Upvote 0
If you disable all VBA code, does that message box still get pushed to the back?
If I do not enable the document that message box does not appear at all.


What relation does the document named in that message box have with your current workbook?
The workbook name that we are working with appears in that message box.
For example, NewExcel.xlsm appears in that message box and is also that workbook's name.

Are they linked?

They appear to be linked through that SharePoint but I do not know why that message box does not appear when not enabled?

Do you have VBA code in the current workbook trying to open that other workbook?
Both documents have VBA code because they are the same document but are in different "locations". One being the cloud for the SharePoint and the other being the more traditional drive pathway.

Both documents are not communicating with each another through VBA code.
 
Upvote 0
The message clearly says that the workbook is open already in another application so it must be open somewhere by some other software.

What happens when click on the message ok button? and what do you want to happen ?

Edit: Maybe this issue occurs due to the fact that the two workbooks have the same name. As you know, two workbooks with the smae name cannot be opened in the same excel instance... But then, it seems the other workbook is not open in the same instance so I am not sure why you are getting that popup message.
 
Last edited:
Upvote 0
The message clearly says that the workbook is open already in another application so it must be open somewhere by some other software.

What happens when click on the message ok button? and what do you want to happen ?

Edit: Maybe this issue occurs due to the fact that the two workbooks have the same name. As you know, two workbooks with the smae name cannot be opened in the same excel instance... But then, it seems the other workbook is not open in the same instance so I am not sure why you are getting that popup message.
Hi Jaafar,

Yes, the message does clearly say that the workbook is already open in another application.

My job is to force the other workbook closed and to keep the active workbook open free from that pop-up.

Any suggestions?

Thank you!
pinaceous
 
Upvote 0
Hi Jaafar,

Yes, the message does clearly say that the workbook is already open in another application.

My job is to force the other workbook closed and to keep the active workbook open free from that pop-up.

Any suggestions?

Thank you!
pinaceous
Sorry, I have no idea why this happens, let alone how to fix it. Maybe someone else can help.
 
Upvote 0
Hi Jaafar,

The "working" solution that I came up with was to totally expose that pop-up to force the user to interact with it.

After the pop-up has been disregarded by the user, then the AutoOpen continues.

If that pop-up is not linked by that document's location, then the code bypasses that part.

Basically;

VBA Code:
CreateObject("Shell.Application").MinimizeAll

'AutoOpenCode

CreateObject("Shell.Application").UndoMinimizeAll

ThisWorkbook.Activate
ActiveWindow.WindowState = xlMaximized

Not sure what else I could come up with unless I could somehow block Excel's pop-ups that it provides backstage.

Thanks!
Pinaceous
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,970
Members
449,095
Latest member
Mr Hughes

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