Aktivér JavaScript i netlæseren for at vise LibreOfficeDev Hjælpesider.

MsgBox Function

Viser en dialog indeholdende en besked og returnerer en værdi.

Syntaks:


MsgBox (Prompt As String [,Buttons = MB_OK [,Title As String]]) As Integer

Parametre:

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:

Navngivet konstant

Heltaltsværdi

Definition

MB_OK

0

Vis kun knappen OK.

MB_OKCANCEL

1

Vis knapperne OK og Annuller.

MB_ABORTRETRYIGNORE

2

Vis knapperne Annuller, Prøv igen og Ignorer.

MB_YESNOCANCEL

3

Vis knapperne Ja, Nej og Annuller.

MB_YESNO

4

Vis knapperne ja og nej.

MB_RETRYCANCEL

5

Vis knapperne Prøv igen og Annuller.

MB_ICONSTOP

16

Føj stop-ikonet til dialogen.

MB_ICONQUESTION

32

Føj spørgsmålstegn-ikonet til dialogen.

MB_ICONEXCLAMATION

48

Føj udråbstegn-ikonet til dialogen.

MB_ICONINFORMATION

64

Føj informations-ikonet til dialogen.

128

Første knap i dialogen som standardknap.

MB_DEFBUTTON2

256

Anden knap i dialogen som standardknap.

MB_DEFBUTTON3

512

Tredje knap i dialogen som standardknap.


Returværdi:

Integer

Navngivet konstant

Heltalsværdi

Definition

IDOK

1

OK

IDCANCEL

2

Annullér

IDABORT

3

Afbryd

IDRETRY

4

Forsøg igen

IDIGNORE

5

Ignorér

IDYES

6

Ja

IDNO

7

Nej


Fejlkoder:

5 Ugyldigt Procedurekald

Eksempel:


Sub ExampleMsgBox
Dim sVar As Integer
 sVar = MsgBox("Løkken")
 sVar = MsgBox("Løkken",1)
 sVar = MsgBox( "Las Vegas",256 + 16 + 2,"DialogTitle")
 sVar = MsgBox("Løkken", MB_DEFBUTTON2 + MB_ICONSTOP + MB_ABORTRETRYIGNORE, "Dialogtitel")
End Sub