ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable a few commandbars, but when duplicates? (https://www.excelbanter.com/excel-programming/310109-disable-few-commandbars-but-when-duplicates.html)

Andoni[_49_]

Disable a few commandbars, but when duplicates?
 
Hi and many thanks in advance!


I am using this Macro to disable 2 controls from the differen
CommandBars:


sub Example()
Dim Ctl As CommandBarControl
Dim Cbar As Integer
Dim MyArray
Dim X As Byte
Application.ScreenUpdating = False
MyArray = Array(4, 109)'just eg, actually is bigger
On Error Resume Next
For Cbar = 1 To Application.CommandBars.Count
For Each Ctl In CommandBars(Cbar).Controls
For X = LBound(MyArray) To UBound(MyArray)

Application.CommandBars(Cbar).FindControl(Id:=MyAr ray(X)
Recursive:=True).Enabled = False
Next X
Next Ctl
Next Cbar

End Sub

'My problem comes, because when checking, if I put in: say the standa
toolbar 5 different PrintPreview controls, I will only disable on
them!
so is easy to cheat the program!

How can i solve this

--
Message posted from http://www.ExcelForum.com


Andoni[_53_]

Disable a few commandbars, but when duplicates?
 
Sorry!

Already DONE!

Thanks anyway

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 07:15 PM.

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