How to disable the "options" menu?

  • Thread starter Thread starter Robin
  • Start date Start date
R

Robin

Hi all,

Can anyone tell me how can I achieve this -

Disable the menu item "options" in the "Tools" menu while someone open
my file, and also, this menu item should be enabled while the user
close the file.

Thanks in advance!

Regards,

Robin.
 
I just wrote down:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Worksheet Menu
Bar").Controls("Tools").Controls("Options...").Enabled = Ture
End Sub

Private Sub Workbook_Open()
Application.CommandBars("Worksheet Menu
Bar").Controls("Tools").Controls("Options...").Enabled = False
End Sub

The "Options" menu disabled when the file opening but it isn't enabled
when the file closing, why? anyone knows the problem inside? thanks!
Robin
 
NichHK,

Thanks!

Yes, the Private Sub for Workbook_Open is OK, but it does not work for
the Private Sub for Workbook_BeforeClose - the "Options" menu items
still disabled even though the file closed.
Any problem with this program, could you help me on this?

Robin
 
Robin,
If you do not Option Explicit set and the code you sent is exactly what you
are using, check you spelling of "True".

NickHK
 
Oh, thanks NickHK, it's a stupid mistake, it works now, thank you!
Robin
 
Robin,
There one good reason to use "Option Explicit" on all your modules; the
compiler would have picked that up you.

NickHK
 
Shouldn't you also be doing it on workbook activate/deactivate, so that
Options are available for other workbooks?

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Back
Top