Referencing to controls on a worksheet

  • Thread starter John Nikolopoulos
  • Start date
J

John Nikolopoulos

A worksheet I made has a number of controls (10
ComboBoxes).
How can controls be referenced as a group ?
I tested the structure :
For each ctl in Activesheet.Controls
.....
Next
but it didn't work...
Is there any solution out there?
Thanks
John Nikolopoulos
Serres, GREECE
 
T

Tom Ogilvy

Assume these are comboboxes from the Control Toolbox Toolbar as opposed to
the Forms toolbar.
Dim OleObj as OleObject
Dim cbox as MSForms.Combobox
For each OleObj in ActiveSheet.OleObjects
if typeof OleObj is MSForms.Combobox then
set cbox = OleObj.Object
msgbox cbox.Name
End if
Next
 
T

Tom Ogilvy

Yep, thanks for the catch:

Assume these are comboboxes from the Control Toolbox Toolbar as opposed to
the Forms toolbar.
Dim OleObj as OleObject
Dim cbox as MSForms.Combobox
For each OleObj in ActiveSheet.OleObjects
if typeof OleObj.Object is MSForms.Combobox then
set cbox = OleObj.Object
msgbox cbox.Name
End if
Next
 
I

Ioannis Nikolopoulos

I would like to thank you for your instant reply.
It helps me a lot. Than you again.
sincerely Yours
John Nikolopoulos


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top