Visual Basic for Applications/Custom Dialog Boxes

This lesson introduces custom dialog boxes.

Objectives and SkillsEdit

ReadingsEdit

MultimediaEdit

ExamplesEdit

'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

ActivitiesEdit

See AlsoEdit

ReferencesEdit

  Type classification: this is a lesson resource.