very quick one

grimshaw19

New Member
Joined
Jan 12, 2005
Messages
24
In this particular bit of code:

MsgBox "Access Denied", vbExclamation + vbApplicationModal

What does the vbApplicationModal do?!?!? Whats it there for?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
vbApplicationModal is 0, so actually it really doesn't do much for you. It would really only be there to remind you or someone else reading your code that the modality of the message box is at the application level of Excel. Compare to vbSystemModal which puts the message box on top of all applications, not just Excel.

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> ModalMessages()
    MsgBox "Hi, switch to another app and I disappear.", vbExclamation + vbApplicationModal, "Application Modal"
    MsgBox "Hello, switch to another app and I don't disappear.", vbInformation + vbSystemModal, "System Modal"
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>
 
Upvote 0
The vbApplicationModal argument (constant = 0) means the user must respond to the message box before continuing work in the current Excel application.

The vbSystemModal argumen (constant 4096) means all applications are suspended until the user responds to the message box.


To test this, open Internet Explorer and Excel.

Run this macro from Excel:

Sub Test1()
MsgBox "Hello", vbApplicationModal
End Sub


If you click on your task bar onto IE , the MessageBox goes away. It reappears when you click onto Excel.


Now run this:

Sub Test2()
MsgBox "Hello", vbSystemModal
End Sub


If you click on IE or another app, the MessageBox does not go away, it stays visible and its presence disallows activity you might otherwise want to do in that other app until you click OK or acknowledge that MessageBox.
 
Upvote 0
cheers. that clears that up for me - i kept comin g across it in examples and my lecturers notes but no additional comments!!! Thank heavens for this webboard or id be picking up a broken computer from outside my window by now!!!
 
Upvote 0

Forum statistics

Threads
1,203,052
Messages
6,053,234
Members
444,648
Latest member
sinkuan85

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