562 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Using MsgBox to Display Messages in VBA Macros Part four of a five-part series of blogs |
---|
The MsgBox command in Visual Basic for Applications allows you to display basic messages, but you can also make it prettier, and even use it to ask questions or display multiple-line messages! Read on to find out more about this versatile VBA command.
This blog is part of our Excel macros online tutorial series. Our main business is running training courses in Excel, courses in VBA and training in many other Microsoft applications.
|
You can add a few bells and whistles to a message box - but only a few.
You can display 4 different symbols:
Key word | Symbol |
---|---|
vbCritical |
![]() |
vbQuestion |
![]() |
vbExclamation |
![]() |
vbInformation |
![]() |
So, for example, this would display a message box with an exclamation mark symbol and an OK button (bizarrely, you add your choices together):
'display a message with an exclamation mark symbol
MsgBox "Cats like plain crisps", vbExclamation + vbOKOnly
In addition to the symbols above, you can control which buttons you see as follows:
Key word | Buttons that you get |
---|---|
vbOkCancel | OK and Cancel |
vbOkOnly | OK only |
vbYesNo | Yes and No |
vbAbortRetryIgnore | Abort Retry and Ignore |
vbRetryCancel | Retry and Cancel |
vbYesNoCancel | Yes No and Cancel |
To understand why you would display different combinations of buttons, see the last entry in this blog about asking questions with message boxes.
Parts of this blog |
---|
|
Some other pages relevant to the above blogs include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2023. All Rights Reserved.