Custom Menu related Question

I

Irshad Alam

Generally to disable a custom menu control, we use the following code :

Private Sub Form_Activate()
Dim mnu As Object
Set mnu = CommandBars("MyMenu2")
mnu.Controls(1).Enabled = False
End Sub


But I want to disable sub menu of a menu. to be more clear, I will write in
details :

My MenuBar Name is "MyMenu2" and Menu's is as follows :

GenMenu ReportMenu SalesMenu

EntryForm PerfoRepo VisitEntry
AllRepo Genrepo VisitRepo
SalesTar

Now I want to disable "AllRepo" Sub Menu of my GenMenu.
What additional code I should write to disable a submenu of a menu.

Could any of the professional can advise.

Thanking in advance for your advise.
 
A

Albert D. Kallal

You can usealy just "walk" the same set of contorls

CommandBars("MyMenu2").controls("RepportMenu").Contorls("AllRepo").Enalbed =
false
 
M

Marshall Barton

Irshad said:
Generally to disable a custom menu control, we use the following code :

Private Sub Form_Activate()
Dim mnu As Object
Set mnu = CommandBars("MyMenu2")
mnu.Controls(1).Enabled = False
End Sub


But I want to disable sub menu of a menu. to be more clear, I will write in
details :

My MenuBar Name is "MyMenu2" and Menu's is as follows :

GenMenu ReportMenu SalesMenu

EntryForm PerfoRepo VisitEntry
AllRepo Genrepo VisitRepo
SalesTar

Now I want to disable "AllRepo" Sub Menu of my GenMenu.
What additional code I should write to disable a submenu of a menu.


I think it would go something like this:

mnu.Controls!GenMenu.CommandBar.Controls!AllRepo.Enabled=False
 
Top