Visual Basic for Applications/Custom Dialog Boxes
Appearance
This lesson introduces custom dialog boxes.
Objectives and Skills
[edit | edit source]Readings
[edit | edit source]Multimedia
[edit | edit source]Examples
[edit | edit source]'This macro displays and processes a custom UserForm.
Option Explicit
Private Sub UserForm_Initialize()
Me.ComboBox.AddItem "One"
Me.ComboBox.AddItem "Two"
Me.ComboBox.AddItem "Three"
End Sub
Private Sub OK_CommandButton_Click()
MsgBox "You selected " & Me.ComboBox.Value, vbOKOnly + vbInformation, "Custom Dialog Box"
Unload Me
End Sub
Private Sub Cancel_CommandButton_Click()
Unload Me
End Sub