Excel - Display ComboBox DropDown by VBA

excel, vba

Solution

If you are using ActiveX Controls then see the below, else if you are using Form Controls then replace them with ActiveX Controls if you want the drop down to happen via code. The below code will work for both ActiveX Controls in a Form as well as Worksheet. If the Control is on a worksheet then change `ComboBox1.SetFocus` to `ComboBox1.Activate`

Two ways I can think of...

- Using a simple command

Tried And Tested

Private Sub CommandButton1_Click()
   ComboBox1.DropDown
End Sub

- Using Sendkeys. Sendkeys are unreliable if not used properly.

Tried And Tested

Private Sub CommandButton1_Click()
   ComboBox1.SetFocus
   SendKeys "%{Down}"
End Sub

SCREENSHOTS

Problem

I need a workbook to display the Combobox List Dropdown when it opens. The combobox in the Workbook is a form control, so a shape. Cant seem to find the associated property.

Original source