LibreOfficeDev 25.8 Hjälp
En dialogruta som innehåller ett meddelande visas och ett värde returneras.
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:
| Namngiven konstant | Heltalsvärde | Definition | 
|---|---|---|
| MB_OK | 0 | Visa endast OK-knappen. | 
| MB_OKCANCEL | 1 | Visa knapparna OK och Avbryt. | 
| MB_ABORTRETRYIGNORE | 2 | Visa knapparna Avbryt, Upprepa och Ignorera. | 
| MB_YESNOCANCEL | 3 | Visa knapparna Ja, Nej och Avbryt. | 
| MB_YESNO | 4 | Visa knapparna Ja och Nej. | 
| MB_RETRYCANCEL | 5 | Visa knapparna Upprepa och Avbryt. | 
| MB_ICONSTOP | 16 | Lägg till Stoppikonen i dialogrutan. | 
| MB_ICONQUESTION | 32 | Lägg till Frågeikonen i dialogrutan. | 
| MB_ICONEXCLAMATION | 48 | Lägg till ikonen Utropstecken i dialogrutan. | 
| MB_ICONINFORMATION | 64 | Lägg till Informationsikonen i dialogrutan. | 
| 
 | 128 | Första knappen i dialogrutan som standardknapp. | 
| MB_DEFBUTTON2 | 256 | Andra knappen i dialogrutan som standardknapp. | 
| MB_DEFBUTTON3 | 512 | Tredje knappen i dialogrutan som standardknapp. | 
Integer
| Namngiven konstant | Heltalsvärde | Definition | 
|---|---|---|
| IDOK | 1 | OK | 
| IDCANCEL | 2 | Avbryt | 
| IDABORT | 3 | Avbryt | 
| IDRETRY | 4 | Försök igen | 
| IDIGNORE | 5 | Ignorera | 
| IDYES | 6 | Ja | 
| IDNO | 7 | Nej | 
Sub ExampleMsgBox
Dim sVar As Integer
 sVar = MsgBox("Las Vegas")
 sVar = MsgBox("Las Vegas",1)
 sVar = MsgBox( "Las Vegas",256 + 16 + 2,"Dialog title")
 sVar = MsgBox("Las Vegas", MB_DEFBUTTON2 + MB_ICONSTOP + MB_ABORTRETRYIGNORE, "Dialog title")
End Sub