View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
filo666 filo666 is offline
external usenet poster
 
Posts: 265
Default Help with faceid and button images

hoooo jim; Where have you been????
I have been looking for the answer of this question all day, Thanks for your
answer, today I'm finishing my job day, and tomorow is mothers day (in
Mexico) and nobody works, so I will try your code on wednesday, I hope you'll
be here (or there how ever you want to see it) to tell you how it works and
if I have more questions, Thanks for your Help¡¡¡¡

"Jim Thomlinson" wrote:

Here is some code for a menu bar. A tool bar is almost identical. Whe the
button was originally created this is the macro that is specified in the on
action.

Private Const m_cMenuBar As String = "Worksheet Menu Bar"
Private Const m_cMenuName As String = "FPA"

Private Sub FooterPath()
On Error GoTo ErrorHandler
Dim cbrMenu As CommandBar
Dim ctlCBarControl As CommandBarButton

Set cbrMenu = CommandBars(m_cMenuBar)
Set ctlCBarControl = cbrMenu.Controls(m_cMenuName).Controls("Add Path to
Footer")

If ctlCBarControl.State = msoButtonDown Then
'Call your macro to do something here
ctlCBarControl.State = msoButtonUp
Else
'Call your macro to reverse something here
ctlCBarControl.State = msoButtonDown
End If
Set cbrMenu = Nothing
Set ctlCBarControl = Nothing

End Sub

This code checks the state of the button (button up or button down) and
decides what it needs to do based on that state. For your code you would want
to check the FaceId or caption and do whatever you need to do based on that...

HTH

"filo666" wrote:

I have already read a lot about toolbars and I couldn't find about changing
the faceid icons of my toolbar when a button is selected or deselected (I
mean the same button), please HELP, I realy need to accomplish this.
specifically I can ask you:

1)¿How to define the button name (the one that use VB) in my toolbar?
2) "Set cbrMenuCtrl = Application.CommandBars("Tools").Controls.Add" is to
add a button, but if I want to name a button that has already exist ¿How?

Could comeone paste a simple code of I want to accoplish (when the user
press a button something happend (macro) and the button images changes, and
when the user press the same button (with the new image on it) something
happend (revert the last action) and the button image returs to his original
state.

PLEASE I WILL BE GRATEFULLY