Fungsi MsgBox
Menampilkan kotak dialog yang memiliki pesan dan menghasilkan sebuah nilai.
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:
  
    | Dinamakan konstan | Nilai integer | Definisi | 
  
    | MB_OK | 0 | Hanya menampilkan tombol OKE. | 
  
    | MB_OKCANCEL | 1 | Menampilkan tombol OK dan Batal. | 
  
    | MB_ABORTRETRYIGNORE | 2 | Menampilkan tombol Batalkan, Ulangi, dan Abaikan. | 
  
    | MB_YESNOCANCEL | 3 | Menampilkan tombol Ya, Tidak, dan Batal. | 
  
    | MB_YESNO | 4 | Menampilkan tombol Ya dan Tidak. | 
  
    | MB_RETRYCANCEL | 5 | Menampilkan tombol Ulangi dan Batal. | 
  
    | MB_ICONSTOP | 16 | Tambahkan ikon Berhenti pada dialog. | 
  
    | MB_ICONQUESTION | 32 | Tambahkan ikon Pertanyaan pada dialog. | 
  
    | MB_ICONEXCLAMATION | 48 | Tambahkan ikon Tanda Seru ke dialog. | 
  
    | MB_ICONINFORMATION | 64 | Tambahkan ikon Informasi pada dialog. | 
  
    |   | 128 | Tombol pertama pada dialog sebagai tombol utama. | 
  
    | MB_DEFBUTTON2 | 256 | Tombol kedua pada dialog sebagai tombol utama. | 
  
    | MB_DEFBUTTON3 | 512 | Tambahkan ikon Tanda Seru ke dialog. | 
 
Integer
  
    | Konstanta bernama | Nilai integer | Definisi | 
  
    | IDOK | 1 |  OK | 
  
    | IDCANCEL | 2 |  Batal | 
  
    | IDABORT | 3 |  Gugurkan | 
  
    | IDRETRY | 4 |  Coba Lagi | 
  
    | IDIGNORE | 5 |  Abaikan | 
  
    | IDYES | 6 |  Ya | 
  
    | IDNO | 7 |  Tidak | 
5 Tidak sah dalam pemanggilan prosedur 
Contoh:
Sub ExampleMsgBox
Dim sVar As Integer
 sVar = MsgBox("Las Vegas")
 sVar = MsgBox("Las Vegas",1)
 sVar = MsgBox( "Las Vegas",256 + 16 + 2,"judul Dialog")
 sVar = MsgBox("Las Vegas", MB_DEFBUTTON2 + MB_ICONSTOP + MB_ABORTRETRYIGNORE, "Dialog title")
End Sub