ActiveMenuBar.Visible = False fails in mde? Hide all menubars

K

kiln

I would like to hide all menubars in Access 2000 when the app is in mde
format. I have test that runs in the main form's open event that runs
the following if the app is an mde:

Application.CommandBars.ActiveMenuBar.Visible = False

However, this code fails if in an mde. The none mde code runs fine

Application.CommandBars.ActiveMenuBar.Visible = true

if in a mdb. Is there something about an mde that disallows? The
typically useless error message is:

The expression On Open you entered as the event property setting
produced the following error: The operation on the | object failed.

Otherwise, any technique to hide all menubars is what I'm after.
 
N

Nikos Yannacopoulos

Kiln,

Try this instead:

For each mnb in Application.CommandBars
If mnb.Enabled = True Then mnb.Enabled = False
Next

This may get tricky, though, if you don't track which commandabrs you are
disabling. If you just want the main menubar hidden, try:

If Application.CommandBars("Menu Bar").Enabled = True Then
Application.CommandBars("Menu Bar").Enabled = False
End If

HTH,
Nikos
 
K

kiln

Thanks Nikos that worked well!

Kiln,

Try this instead:

For each mnb in Application.CommandBars
If mnb.Enabled = True Then mnb.Enabled = False
Next

This may get tricky, though, if you don't track which commandabrs you are
disabling. If you just want the main menubar hidden, try:

If Application.CommandBars("Menu Bar").Enabled = True Then
Application.CommandBars("Menu Bar").Enabled = False
End If

HTH,
Nikos
 

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

Top