Excel - CommandBars

 
Vista:
sin imagen de perfil

CommandBars

Publicado por ricaurtem (206 intervenciones) el 20/11/2006 15:21:33
Hola que tal tengo un problema les explico

tengo estas variables
Public MENUOBJECT As CommandBarPopup
Public MENUITEM As Object
Public SUBMENUITEM As CommandBarButton
Public TOOLBAR As Object
Public BOTONTOOLBAR As CommandBarButton

He creado un menu asi
'CREA EL MENU
Set MENUOBJECT = Application.CommandBars(1).Controls.Add(msoControlPopup, , , , True)
MENUOBJECT.Caption = "Tabla VF &GB"
MENUOBJECT.OnAction = "CAMBIAR_TEXTO"

y luego un boton en ese menu asi

'CREA UN BOTON PARA EL MENU
Set MENUITEM = MENUOBJECT.Controls.Add(msoControlButton, , , , True)
MENUITEM.Caption = "Ocultar Barra de Valor Futuro G&B"
MENUITEM.OnAction = "MOSTRAR_OCULTAR_BARRA"
MENUITEM.FaceId = 1992

Luego creo una toolbar asi

'AGREGA LA BARRA DE HERRAMIENTAS
Set TOOLBAR = Application.CommandBars.Add("INTERES, SALDO Y VALOR_FUTURO", msoBarFloating, , True)
Application.CommandBars("INTERES, SALDO Y VALOR_FUTURO").Protection = msoBarNoCustomize + msoBarNoResize

y le agrego un boton asi

'BOTONES DE LA BARRA DE HERRAMIENTAS
Set BOTONTOOLBAR = TOOLBAR.Controls.Add(msoControlButton)
BOTONTOOLBAR.Caption = "&Columna de Flujo"
BOTONTOOLBAR.OnAction = "RANGOCOLFLUJO"
BOTONTOOLBAR.Style = msoButtonIconAndCaptionBelow 'ICONO Y TEXTO ABAJO
BOTONTOOLBAR.FaceId = 2147

y al final muestro la barra
Application.CommandBars("INTERES, SALDO Y VALOR_FUTURO").Visible = True

Entonces no me da la cabeza, porque quiero hacer que cuando esa barra no este visible, el caption del boton en el menu ("Ocultar Barra de Valor Futuro G&B") en vez de ocultar diga "Mostrar" y viceversa.


y tengo esto para cambiarlo, pero no se como me referencio al boton que cree para el menu

Sub CAMBIAR_TEXTO()
If Application.CommandBars("INTERES, SALDO Y VALOR_FUTURO").Visible = True Then

ElseIf Application.CommandBars("INTERES, SALDO Y VALOR_FUTURO").Visible = False Then

End If

End Sub

AYUDA ,HELP ME PLEASE
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder