ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FindControl ?!? (https://www.excelbanter.com/excel-programming/288819-findcontrol.html)

Tom

FindControl ?!?
 
Hi

The FindControl returns the first element or Nothing, if no control was
found. But I want to find all controls, that are available. How to do?

Tom



Chip Pearson

FindControl ?!?
 
Tom,

It isn't clear what you are trying to do, but Office 2000 and
later supports the FindControls method that will return a
collection of controls.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Tom" wrote in message
...
Hi

The FindControl returns the first element or Nothing, if no

control was
found. But I want to find all controls, that are available. How

to do?

Tom





Tom

FindControl ?!?
 
Chip

I need to find all sorting buttons (IDs 210, 211, 1209, 6687) that are in
the toolsbars of Excel. In a second step the enabled-property of all these
controls must be set to false. The tool should work for Excel 97, 2000, XP &
2003.

Tom





"Chip Pearson" schrieb im Newsbeitrag
...
Tom,

It isn't clear what you are trying to do, but Office 2000 and
later supports the FindControls method that will return a
collection of controls.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Tom" wrote in message
...
Hi

The FindControl returns the first element or Nothing, if no

control was
found. But I want to find all controls, that are available. How

to do?

Tom







Ron de Bruin

FindControl ?!?
 
Hi Tom

This will work in 97-2003

Sub menuItem_EnabledFalse()
Dim a As Integer
On Error Resume Next
For a = 1 To Application.CommandBars.Count
For Each ctl In CommandBars(a).Controls
Application.CommandBars(a).FindControl(Id:=210, Recursive:=True).Enabled = False
Next ctl
Next a
End Sub

Sub menuItem_EnabledTrue()
Dim a As Integer
On Error Resume Next
For a = 1 To Application.CommandBars.Count
For Each ctl In CommandBars(a).Controls
Application.CommandBars(a).FindControl(Id:=210, Recursive:=True).Enabled = True
Next ctl
Next a


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Tom" wrote in message ...
Chip

I need to find all sorting buttons (IDs 210, 211, 1209, 6687) that are in
the toolsbars of Excel. In a second step the enabled-property of all these
controls must be set to false. The tool should work for Excel 97, 2000, XP &
2003.

Tom





"Chip Pearson" schrieb im Newsbeitrag
...
Tom,

It isn't clear what you are trying to do, but Office 2000 and
later supports the FindControls method that will return a
collection of controls.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Tom" wrote in message
...
Hi

The FindControl returns the first element or Nothing, if no

control was
found. But I want to find all controls, that are available. How

to do?

Tom










All times are GMT +1. The time now is 05:43 PM.

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