HELP - How do I disable Excels menu items so others can't use

  • Thread starter Thread starter Marcello do Guzman
  • Start date Start date
M

Marcello do Guzman

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:

(e-mail address removed)

SIncerely,


Marcello
 
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
 
try using the code in workbook activate deactivate events so for othe
workbooks the menu bar will be available.


ignore this code if you can not switch the windows when the menuar i
hidden ( ctrl+tab )(i dont know if u can swich windows when menubar i
hidden
 
Back
Top