I'm trying to prevent any built-in command bars or menu bars from appearing
in an Access MDE.
I have the following code on the Form_Open event of the app's main form:
CommandBars("Me nu Bar").Enabled = False
This works, but if a user has been using Access with a tool bar visible
(Form/Report
Formatting, for example) prior to opening my MDE, that tool bar is still
visible when my MDE is opened - despite not having a Menu Bar.
Can I just loop through the entire collection of command bars and disable
them all?
'Required reference Office 11.0 Object Library
Dim cb As CommandBar
For Each cb In CommandBars
cb.Enabled = False
Next
There are 177 named CommandBars in this loop, however. If I go to Tools >
Customize, I see only 28 Toolbars (on the Toolbars tab of the Customize
dialog).
Which toolbars can I safely disable? The only ones I really need to hide
are the ones that may still be visible after the app's main form is
maximized and the Menu Bar is disabled (since toolbars cannot be made
visible if there is no Menu Bar and the main form is maximized). The stuff
available on right click I can deal with elsewhere.
Other suggestions?
Thanks in advance.