MSGBOX |
MSGBOX(prompt[, buttons] [, title] [, helpfile, context]) |
Displays a dialog box displaying a message to the user (Integer). |
prompt | The message to be displayed (String). |
buttons | (Optional) The sum of values specifying the type of buttons to display 0 = vbOKOnly 1 = vbOkCancel 2 = vbAbortRetryCancel 3 = vbYesNoCancel 4 = vbYesNo 5 = vbRetryCancel 16 = vbCritical 32 = vbQuestion 48 = vbExclamation 64 = vbInformation 0 = vbDefaultButton1 (first button displayed is the default) 256 = vbDefaultButton2 (second button displayed is the default) 512 = vbDefaultButton3 (third button displayed is the default) 768 = vbDefaultButton4 (fourth button displayed is the default) 0 = vbApplicationModal 4094 = vbSystemModal 16384 = vbMsgBoxHelpButton (displays a help button) 65536 = vbMsgBoxSetForeground 524288 = vbMsgBoxRight 1048576 = vbMsgBoxRtlReading |
title | (Optional) The title to display at the top of the dialog box (String) |
helpfile | (Optional) The help file to use to provide context-sensitive Help. |
context | (Optional) The context number assigned to the appropriate help topic. |
REMARKS |
* For more information, refer to the Msgbox & InputBox > MsgBox page. * This function can display a message and also ask Yes/No or OK/Cancel questions. * When both "helpfile" and "context" are provided, the user can press F1 to view the Help topic corresponding to the context. * To omit some positional arguments you must include the corresponding comma delimiters. * If "default" is left blank, then the textbox is displayed empty. * If "xpos" is left blank, the dialog box is centred horizontally. * If "ypos" is left blank, the dialog box is centred vertically. * If "helpfile" is provided, then "context" must also be provided. * If "context" is provided, then "helpfile" must also be provided. * If the dialog box displays a Cancel button, pressing the ESC key has the same effect as clicking Cancel. * If the dialog box contains a Help button, context-sensitive Help is provided for the dialog box. However, no value is returned until one of the other buttons is clicked. * The values that are returned specify which button was pressed. 1 = vbOK. 2 = vbCancel. 3 = vbAbort. 4 = vbRetry. 5 = vbIgnore. 6 = vbYes. 7 = vbNo. * You can use the INPUTBOX function for displaying a dialog box allowing information to be entered. * The equivalent .NET function is Microsoft.VisualBasic.Interaction.MsgBox * For the Microsoft documentation refer to learn.microsoft.com |
MsgBox "message"
Call MsgBox("Unable open file", VBA.vbMsgBoxStyle.vbCritical, "File")
Call MsgBox("This file has been saved", VBA.vbMsgBoxStyle.vbOKOnly)
Call MsgBox("Press any key to continue", , "Macro Interrupted")
If MsgBox("save the file ?", VBA.vbMsgBoxStyle.vbYesNo) = VBA.vbMsgBoxResult.vbYes Then
End If
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top