Graying technique of toolbar buttons

  • Thread starter Thread starter Luut
  • Start date Start date
L

Luut

Hello.

I wonder if the following is programmable in VBA: when
working in PP, some toolbar buttons stay gray when they
can't be used at the moment. I programmed a custom toolbar
and ask myself if I can program the same trick PP uses for
graying the buttons. For instance: I programmed a button
that triggers a sub that executes a code to center the
current selected shapes in relation to eachother. It would
be cool if the button stays gray as long as only one shape
is selected on a slide. In case more then 2 shapes are
selected the button automatically has to jump to full
color.

Can this be done in VBA? If yes, how? If not, how does PP
do it then?

Greetz, Luut.
 
Luut said:
Hello.

I wonder if the following is programmable in VBA: when
working in PP, some toolbar buttons stay gray when they
can't be used at the moment. I programmed a custom toolbar
and ask myself if I can program the same trick PP uses for
graying the buttons. For instance: I programmed a button
that triggers a sub that executes a code to center the
current selected shapes in relation to eachother. It would
be cool if the button stays gray as long as only one shape
is selected on a slide. In case more then 2 shapes are
selected the button automatically has to jump to full
color.

'
Dim MyButton As CommandBarButton
Set MyButton = CommandBars("ToolbarName").Controls.Item("ButtonName")

MyButton.Enabled = False ' to gray it out or True to re-enable it
' and also useful:
MyButton.State = msoButtonDown ' or msoButtonUp, your choice

You'd put code that uses these in an event handler. See this for more
info:

Make PPT respond to events
http://www.rdpslides.com/pptfaq/FAQ00004.htm
 
Luut,
Here are two possible approaches depending upon the version and the type of
menu item.

A) When it is a button on the toolbar, then you would need to traps either
PowerPoint windows selection events available within PowerPoint or
CommandBar events to ascertain the type or selection and criteria for which
the button would be enabled /disabled. (required PPT 2000 or later)

B) If the button(s) are placed within a popup, the popup can be set to run a
macro which ascertains the selection criteria and based on that toggles the
state of the child menu items.

--
Regards
Shyam Pillai

Handout Wizard
http://www.mvps.org/skp/how/
 
Hey Shyam, thanx a lot again for your quick response.
Maybe you have time to answer my other question in the
following thread: New paste special prob.

Thanx in advance!

Greetings, Luut.
 
Hey Steve, thanx a lot again for your quick response.
Maybe you have time to answer my other question in the
following thread: New paste special prob.

Thanx in advance!

Greetings, Luut.
 
Back
Top