LibreOffice 24.8 帮助
显示一个含有消息的对话框。
   MsgBox prompt As String [,buttons = MB_OK [,title As String]]
   response = MsgBox( prompt As String [,buttons = MB_OK [,title As String]])
prompt: String expression displayed as a message in the dialog box. Line breaks can be inserted with Chr$(13).
title: String expression displayed in the title bar of the dialog. If omitted, the title bar displays the name of the respective application.
buttons: Any integer expression that specifies the dialog type, as well as the number and type of buttons to display, and the icon type. buttons represents a combination of bit patterns, that is, a combination of elements can be defined by adding their respective values:
| 已命名的常量 | 整数值 | 定义 | 
|---|---|---|
| MB_OK | 0 | 仅显示「确定」按钮。 | 
| MB_OKCANCEL | 1 | 显示「确定」和「取消」按钮。 | 
| MB_ABORTRETRYIGNORE | 2 | 显示「中止」「重试」和「忽略」按钮。 | 
| MB_YESNOCANCEL | 3 | 显示「是」「否」和「取消」按钮。 | 
| MB_YESNO | 4 | 显示「是」和「否」按钮。 | 
| MB_RETRYCANCEL | 5 | 显示「重试」和「取消」按钮。 | 
| MB_ICONSTOP | 16 | 在对话框中添加「停止」图标。 | 
| MB_ICONQUESTION | 32 | 在对话框中添加「问号」图标。 | 
| MB_ICONEXCLAMATION | 48 | 在对话框中添加「感叹号」图标。 | 
| MB_ICONINFORMATION | 64 | 在对话框中添加「信息」图标。 | 
| 
 | 128 | 将对话框中的第一个按钮作为默认按钮。 | 
| MB_DEFBUTTON2 | 256 | 将对话框中的第二个按钮作为默认按钮。 | 
| MB_DEFBUTTON3 | 512 | 将对话框中的第三个按钮作为默认按钮。 | 
Sub ExampleMsgBox
 Const sText1 = "发生意外错误。"
 Const sText2 = "但程序将继续执行。"
 Const sText3 = "错误"
 MsgBox(sText1 + Chr(13) + sText2,16,sText3)
 MsgBox(sText1 + Chr(13) + sText2, MB_ICONSTOP, sText3)
End Sub