Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Commandbuttons collection?

Status
Not open for further replies.

leassaf

Instructor
May 20, 2001
49
IL
I've placed Commandbuttons on an Excel worksheet. I've written some code for some of their events under the worksheet module. Is it possible to cycle through their collection(if there is one, such as CommandButtons)?

something like:

dim Cmd as CommandButton

For each Cmd in CommandButtons
Debug.Print Cmd.Name
Next Cmd

Thanks,

Assaf
 
in access you can use something on the lines of:

dim ctrl as control

for each ctrl = me.controls

if ctrl.type = acButton ' not sure of the constant

next ctrl

I will have got the syntax quite wrong, but hopefully this may help.

Nick
 
Dim i
For i = 1 To ActiveSheet.Shapes.Count
MsgBox ActiveSheet.Shapes(i).Type
MsgBox ActiveSheet.Shapes(i).Name
Next i

u want to use the shape type with values 8 or 12 (i don't know their exact name), i presume
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top