Msg Box

MsgBox is VisualBasic's wrapper for the Win32 MessageBox API function. It takes a message body, a title and constant for which buttons to display (like OK, Cancel, Yes, No, etc.)

Pretty impressive, eh?

Very nice, but the next time I paste in VB code remind me to put SixSingleQuotes around these kinds of identifiers:-)


I once asked my class what was wrong with:

  MsgBox("Do you wish to continue?", vbOkOnly + vbExclamation) 
No-one noticed that even though the box asks a yes or no question, it displays only an OK button and also an ! icon instead of a ?.


See also: VbaExercises


EditText of this page (last edited November 8, 2008) or FindPage with title or text search