Looping thru custom controls

P

papou

Hi all
Excel 2K
I need to loop through a number of custom controls and enable some of them.
I can identify these controls with their .tag property which will always
begin with "AVV"
So I thought I could use the .FindControl method and the Like operator, but
I cannot figure out how to do it.
Could somebody explain how to achieve this?
TIA
Regards
Pascal
 
P

Patrick Molloy

dim ctrl as Control
For Each Ctrl in Controls

If ctrl.Tag LIKE "TVV*" Then
ctrl.Enabled = True
End If

Next



HTH
Patrick Molloy
Microsoft Excel MVP
 
P

papou

Hi Tom
Thank you very much for your answer.
Since I was only looking for controls within the Worksheet Menu Bar,I
eventually found a "lighter" solution with the following:
For Each Cb In Application.CommandBars("Worksheet Menu Bar").Controls
If Cb.Caption = "Options &Cotation" Then
For Each Ctl In Cb.Controls
If Ctl.Type = 10 Then
For Each SousCtl In Ctl.Controls
If SousCtl.Tag Like "A*" Then
SousCtl.Enabled = True
End If
Next SousCtl
End If
Next Ctl
End If
Next Cb
Thanks again Tom
Regards
Pascal
 

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