Visual Basic for Applications/Custom Dialog Boxes

From Wikiversity
Jump to navigation Jump to search

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

Activities[edit | edit source]

See Also[edit | edit source]

References[edit | edit source]

Nuvola apps edu miscellaneous.svg Type classification: this is a lesson resource.