Custom Menu related Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
You can usealy just "walk" the same set of contorls

CommandBars("MyMenu2").controls("RepportMenu").Contorls("AllRepo").Enalbed =
false
 
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
 
Back
Top