How to trigger a VBA Sub from an action?

Started by VisDom, October 17, 2017, 03:46:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

VisDom

Hi all,

I have two rectangles A and B grouped togeather. B is small and is placed within A. I have an action on the group. I would like to run a VBA sub when the user tiggers that action. The action could be for Example "Show/Hide rectangle B"! Is this possible to do that with VBA? Further more I will want to use this as a master shape. I will have many shapes on my page.

I know this can be done with ShapeSheet-Code but I explicitly want to use VBA.

VisDom

Surrogate

#1
In ThisDocument code module place code
Sub HideShowB(shp As Shape)
Dim shB As Shape
Dim VisibleState As Boolean
' define sub-shape B
Set shB = shp.Shapes(2)
' check sub-shape B visible state
VisibleState = shB.Cells("Geometry1.NoShow")
' change sub-shape B visible state
shB.Cells("Geometry1.NoShow") = Not (VisibleState)
End Sub

In group shape in action row, in cell Action place formula
CALLTHIS("thisdocument.HideShowB")