Como ejecutar una macro al hacer clic en un shape
Tengo 8 shapes en una hoja de calculo, quiero que al hacer clic en cualquiera de ellos Cambie de color y se ejecute una macro, esto es lo que he logrado hacer
Sub c_Boton()
Dim anterior As String
Dim actual As Shape
Dim Principal(8) As String
Principal(1) = General
Principal(2) = Acciones Gubernamentales
Principal(3) = Contexto
Principal(4) = Infraestructura Municpal
Principal(5) = Reportes
Principal(6) = Glosario
Principal(7) = Ayuda
Principal(8) = Créditos
'Crea los botones de la ventana principal
Set myDocument = Worksheets(1)
With myDocument.Shapes
For i = 1 To 8
If i = 1 Then
pos = 5
Else
pos = pos + 97
End If
With .AddShape(msoShapeRoundedRectangle, pos, 5, 90, 35)
.Placement = xlFreeFloating
.Name = Botón & Len(Str(i))
If i = 1 Then
.ShapeStyle = 28 'Para cuando esta seleccionado
Else
.ShapeStyle = 42 'para cuando esta seleccionado
End If
.TextFrame.Characters.Text = Principal(i)
With .TextFrame
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.MarginTop = 0
.Characters(1, Len(Principal(i))).Font.Bold = True
End With
nombre = .Name
.OnAction = "PASO"
End With
Next
End With
End Sub
Al llegar a .option paso, no se como pasar los argumentos al procedimiento paso y que el shape que le di clic cambie de relleno (ShapeStyle = 42) a /ShapeStyle = 28 y se ejecute otro procedimiento.
Gracias por el apoyo