VBA - using .onAction on SmartArtNodes

I am new to VBA and am trying to use smartArt.Nodes to dynamically create an organization chart based on some cell data. I can create a diagram with no problem. Now I would like to be able to display more detailed information about specific nodes of the chart by clicking on them. I know we can convert smartArts to shapes using drawing tools in Excel and then use .onAction on them, like this:

ActiveSheet.Shapes(name1).OnAction = "detail"

      

However, is there a way to achieve the same with smartArt.nodes using VBA? Let's say I have a node called "nodes1" which I tried:

nodes1.Shapes.OnAction = "detail"

      

or

Dim objShape As Shape
Dim SmartArtNod As SmartArtNode
Set objShape = ActiveSheet.Shapes(1)
Set SmartArtNod = objShape.SmartArt.AllNodes(1)

SmartArtNod.Shapes(1).OnAction = "detail"

      

and other combinations, but none of them seem to work ... Thanks for the help!

+3


source to share


1 answer


It is difficult to prove denial, but I believe it is impossible. Testing with Excel 2013, I can confirm that the following doesn't work:

  • Attempting to grab a SmartArt selection using Worksheet_SelectionChanged

    does not work. If you change the selection from a cell to SmartArt, you will not receive the event. However, you will receive an event when you lose focus on SmartArt and return to the camera.

  • You can select the SmartArt and then debug to check what is selected. The object is of type Object/Shape

    and the viewport indicates what it provides OnAction

    , but trying to set this property will fail.



I'm taking the above two questions to mean that it will be very difficult (if not impossible) to get the event OnAction

to trigger SmartArt.

+1


source







All Articles