Click to See Complete Forum and Search --> : VBA - Need to look at Checkboxs on a worksheet


Spudwise
March 23rd, 2001, 11:59 AM
Greetings,
I need to loop through an array of checkboxes placed on a worksheet, not a form. With what I'm trying, I get a error - Object does not support property or method. How do I reference the controls on that worksheet?
Thanks

GungaDin
March 25th, 2001, 05:13 PM
I think you may want to try something like this:



Dim xlSheet as Excel.Worksheet
Dim shp as Excel.Shape

set xlSheet = Worksheets("Sheet1")

for Each shp In xlSheet.Shapes
' If the type is an OLE Control
If shp.Type = msoOLEControlObject then
MsgBox shp.Name
End If
next





You may have to change the type to whatever you are looking for. (I think that type is correct if you are using the Control Toolbox in VB), but I think that should get you going.

Hope this helps,

Nathan.

Spudwise
March 28th, 2001, 01:08 PM
Thanks Nathan, I'll try it. I have, however, reworked my approach to what I'm trying to solve.
Ken