Visual Basic for Applications/Custom Dialog Boxes

This lesson introduces custom dialog boxes.

Objectives and Skills

edit

Readings

edit

Multimedia

edit

Examples

edit
'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

Activities

edit

See Also

edit

References

edit
  Type classification: this is a lesson resource.