ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing the Style of a Combobox Via It's Name (https://www.excelbanter.com/excel-programming/286058-changing-style-combobox-via-its-name.html)

Kent

Changing the Style of a Combobox Via It's Name
 
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



Paul Reynolds[_2_]

Changing the Style of a Combobox Via It's Name
 
You can do this via the OLEObjects collection for the sheet, e.g:

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

Hope this helps,
Paul

"Kent" wrote in message
...
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






All times are GMT +1. The time now is 05:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com