Disable commands in menu bar on startup

A

akphidelt

Hi, im running in to a little problem that I can't find a solution for.

I have built a custom menu bar that has the items that I want for my
application.

However, I want some of the items to be disabled whenever the application
starts up and enabled when a user enters the correct password information.
For some reason I can't figure out how to disable them at startup. I can do
it through the Immediate Window when testing. Here is an example

Application.CommandBars("POD").Controls("Reports").Enabled = False

Now that works and disables the Reports command but then when someone types
in the correct password and enables it the command remains enabled on the
next startup.

Does anyone have an idea on how to do this?
 
R

Rick Brandt

akphidelt said:
Hi, im running in to a little problem that I can't find a solution
for.

I have built a custom menu bar that has the items that I want for my
application.

However, I want some of the items to be disabled whenever the
application starts up and enabled when a user enters the correct
password information. For some reason I can't figure out how to
disable them at startup. I can do it through the Immediate Window
when testing. Here is an example

Application.CommandBars("POD").Controls("Reports").Enabled = False

Now that works and disables the Reports command but then when someone
types in the correct password and enables it the command remains
enabled on the next startup.

Does anyone have an idea on how to do this?

You have to disable it on startup every time and then decide when to enable
them (every time).
 
A

akphidelt

Yea, but how do I disable them on startup every time? I know how to hide the
entire menu bar but how do you disable the actual menu bar control on startup.
 
R

Rick Brandt

akphidelt said:
Yea, but how do I disable them on startup every time? I know how to
hide the entire menu bar but how do you disable the actual menu bar
control on startup.

With the same code that you used in the immediate window. Call that from
the AutoExec macro or else run that code in the Open or Load event of
whatever form you display at startup.
 
A

akphidelt

Touche my friend, touche!

Thanks a bunch

Rick Brandt said:
With the same code that you used in the immediate window. Call that from
the AutoExec macro or else run that code in the Open or Load event of
whatever form you display at startup.
 

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