Disable a few commandbars, but when duplicates?

A

Andoni

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:=MyArray(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
 

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