Ajuda del LibreOffice 25.2
Mostra un quadre de diàleg que conté un missatge i torna un valor.
MsgBox (Prompt As String [,Buttons = MB_OK [,Title As String]]) As Integer
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:
| Constant amb nom | Valor enter | Definició | 
|---|---|---|
| MB_OK | 0 | Mostra només el botó «D'acord». | 
| MB_OKCANCEL | 1 | Mostra els botons «D'acord» i «Cancel·la». | 
| MB_ABORTRETRYIGNORE | 2 | Mostra els botons «Avorta», «Reintenta« i «Ignora». | 
| MB_YESNOCANCEL | 3 | Mostra els botons «Sí», «No» i «Cancel·la». | 
| MB_YESNO | 4 | Mostra els botons «Sí» i «No». | 
| MB_RETRYCANCEL | 5 | Mostra els botons «Reintenta» i «Cancel·la». | 
| MB_ICONSTOP | 16 | Afig la icona de «Stop» al diàleg. | 
| MB_ICONQUESTION | 32 | Afig la icona de pregunta al diàleg. | 
| MB_ICONEXCLAMATION | 48 | Afig la icona d'exclamació al diàleg. | 
| MB_ICONINFORMATION | 64 | Afig la icona d'informació al diàleg. | 
| 
 | 128 | Estableix el primer botó del diàleg com a botó predeterminat. | 
| MB_DEFBUTTON2 | 256 | Estableix el segon botó del diàleg com a botó predeterminat. | 
| MB_DEFBUTTON3 | 512 | Estableix el tercer botó del diàleg com a botó predeterminat. | 
Enter
| Constant amb nom | Valor enter | Definició | 
|---|---|---|
| IDOK | 1 | D'acord | 
| IDCANCEL | 2 | Cancel·la | 
| IDABORT | 3 | Interromp | 
| IDRETRY | 4 | Reintenta | 
| IDIGNORE | 5 | Ignora | 
| IDYES | 6 | Sí | 
| IDNO | 7 | No | 
Sub ExampleMsgBox
Dim sVar As Integer
 sVar = MsgBox("Las Vegas")
 sVar = MsgBox("Las Vegas",1)
 sVar = MsgBox( "Las Vegas",256 + 16 + 2,"Títol del diàleg")
 sVar = MsgBox("Vilanova dels Arcs", MB_DEFBUTTON2 + MB_ICONSTOP + MB_ABORTRETRYIGNORE, "Títol del diàleg")
End Sub