View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Andoni[_49_] Andoni[_49_] is offline
external usenet poster
 
Posts: 1
Default 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