View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default HELP - How do I disable Excels menu items so others can't use

Try this

For the Visual Basic Editor use the number 1695
This will work in 97-2003

Sub menuItem_Enabledfalse()
Dim a As Integer
On Error Resume Next
For a = 1 To Application.CommandBars.Count
For Each ctl In CommandBars(a).Controls
Application.CommandBars(a).FindControl(Id:=186, Recursive:=True).Enabled = False
Next ctl
Next a
End Sub

Sub menuItem_Enabledtrue()
Dim a As Integer
On Error Resume Next
For a = 1 To Application.CommandBars.Count
For Each ctl In CommandBars(a).Controls
Application.CommandBars(a).FindControl(Id:=186, Recursive:=True).Enabled = True
Next ctl
Next a
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Marcello do Guzman" wrote in message ...
I was able to figure out how to disable shortcut keys, but I need to
disable the following menu items so that users can't use them while my
Excel application is open.

- MACROS list box
- Visual Basic Editor


I also need to be able to reinstate the above menu items so that they
can used after I close the Excel application.

I hope you can help me with this and provide the code and where
exactly I should place it in the VBE.

Thank you in advance. Please reply via email:



SIncerely,


Marcello