CommandBarButtons not responding

D

Dale Fye

The problem seems to go beyond my previous post about the "state" not
changing. Actually, the stat is changing, it is just not being displayed in
the popup menu; and it gets more intriguing. I have two lines of code that
either enable or disable two of my CommandBarButtons based on the value of a
multipage control.

Application.CommandBars.FindControl(Tag:="FilePrintCapability").Enabled =
(intTabNum = 0)
Application.CommandBars.FindControl(Tag:="FilePrintGap").Enabled =
(intTabNum = 1)

These two lines of code should be enabling one button and disabling another,
but are doing nothing. The Enabled property of these buttons is staying as
True regardless of the value of intTabNum.

Any help would be greatly appreciated.

Dale
 
S

sebastienm

Hi
Try:
-if you have a 'On Error Resume Next' before setting the Enabled property,
then comment it out and try running again. (could be that the FindCOntrol
doesn't find anything and so the 'Enabled =' would do nothing).
- what is the datatype of intTabNum
- just before and after '...Enabled =', try
debug.print (intTabNum = 0)
debug.print (intTabNum = 1)
 
D

Dale Fye

Sebastien,

When I step through my code, and print the value of the Enabled property of
each of these buttons, they are correct, one is enabled, the other disabled,
but when I popup the menu, both items appear and respond as if they are
enabled.

Generally the same issue with changing the state of another button, the
state property of the button displays the correct value when it is printed,
but when the state = msoButtonDown, the button should display a checkbox, and
it doesn't.

I thought that maybe I was creating another copy of a commandbar that
already exists, but confirmed that the commandbars are deleted and recreated
in the initialize event of the form.

Help!!!!!!!!!!!!!!!!!

Dale
 

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