Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Latest commit

 

History

History
43 lines (26 loc) · 865 Bytes

dropdown-method-example.md

File metadata and controls

43 lines (26 loc) · 865 Bytes
title keywords f1_keywords ms.prod ms.assetid ms.date
DropDown Method Example
fm20.chm5225153
fm20.chm5225153
office
0a450210-9e10-d1f0-cb01-567115c9bfda
06/08/2017

DropDown Method Example

The following example uses the DropDown method to display the list in a ComboBox. The user can display the list of a ComboBox by clicking the CommandButton.

To use this example, copy this sample code to the Declarations portion of a form. Make sure that the form contains:

  • A ComboBox named ComboBox1.

  • A CommandButton named CommandButton1.

Private Sub CommandButton1_Click() 
 ComboBox1.DropDown 
End Sub 
 
Private Sub UserForm_Initialize() 
 ComboBox1.AddItem "Turkey" 
 ComboBox1.AddItem "Chicken" 
 ComboBox1.AddItem "Duck" 
 ComboBox1.AddItem "Goose" 
 ComboBox1.AddItem "Grouse" 
End Sub