MsgBox Function
Amuesa un cuadru de diálogu que contién un mensaxe y devuelve un valor.
Sintaxis:
MsgBox (Testu As String [,Tipu As Integer [,TítuloDiálogu As String]])
Valor de torna:
Enteru
Parámetros:
Testu: Espresión de cadena que s'amuesa como mensaxe nel cuadru de diálogu. Los saltos de llinia puen inxertase con Chr$(13).
TítuloDiálogu: Espresión de cadena que s'amuesa na barra de títulu del diálogu. Si omítese, amuésase'l nome de l'aplicación correspondiente.
Tipu: Cualquier espresión entera qu'especifique'l tipu de diálogu y defina el númberu y tipu de botones o iconos que s'amuesen. Tipu representa una combinación de patrones de bits (elementos de diálogu definíos al amestar los valores correspondientes):
Valores
Named constant |
Integer value |
Definition |
MB_OK |
0 |
Display OK button only. |
MB_OKCANCEL |
1 |
Display OK and Cancel buttons. |
MB_ABORTRETRYCANCEL |
2 |
Display Abort, Retry, and Ignore buttons. |
MB_YESNOCANCEL |
3 |
Display Yes, No, and Cancel buttons. |
MB_YESNO |
4 |
Display Yes and No buttons. |
MB_RETRYCANCEL |
5 |
Display Retry and Cancel buttons. |
MB_ICONSTOP |
16 |
Add the Stop icon to the dialog. |
MB_ICONQUESTION |
32 |
Add the Question icon to the dialog. |
MB_ICONEXCLAMATION |
48 |
Add the Exclamation Point icon to the dialog. |
MB_ICONINFORMATION |
64 |
Add the Information icon to the dialog. |
|
128 |
First button in the dialog as default button. |
MB_DEFBUTTON2 |
256 |
Second button in the dialog as default button. |
MB_DEFBUTTON3 |
512 |
Third button in the dialog as default button. |
Valores de torna:
Named constant |
Integer value |
Definition |
IDOK |
1 |
OK |
IDCANCEL |
2 |
Cancel |
IDABORT |
3 |
Abort |
IDRETRY |
4 |
Retry |
IDIGNORE |
5 |
Ignore |
IDYES |
6 |
Yes |
IDNO |
7 |
No |
Exemplu:
Sub ExampleMsgBox
Dim sVar As Integer
sVar = MsgBox("Les Vegues")
sVar = MsgBox("Les Vegues",1)
sVar = MsgBox( "Les Vegues",256 + 16 + 2,"Títulu de diálogu")
sVar = MsgBox("Las Vegas", MB_DEFBUTTON2 + MB_ICONSTOP + MB_ABORTRETRYCANCEL, "Dialog title")
End Sub