Changing the Style of a Combobox Via It's Name

  • Thread starter Thread starter Kent
  • Start date Start date
K

Kent

I have multiple comboboxes addes to a worksheet. I would like to write a
subroutine that changes the style property of the combobox. I want to
reference the combobox by its name that is passed as a parameter to the
subroutine. I can't seem to write the code that references the combobox by
this passed parameter name.

Thanks,
Kent
 
You can do this via the OLEObjects collection for the sheet, e.g:

Private Sub SetStyleCombo(sComboBoxName as String)
Worksheets("Sheet1").OLEObjects(sComboBoxName).Object.Style =
fmStyleDropDownCombo
End Sub

Hope this helps,
Paul
 
Back
Top