msoSmartArtNodeTypeAssistant - Adding Assistant in Excel smartart using VBA does not work

Viewed 148

I am developing a macro that creates a SmartArt hierarchy (org chart) based on Excel lists. Some staff should be shown as "assistant", and manually adding assistants to the SmartArt works fine. However, when I use

saNode = MyOrgChart.SmartArt.AllNodes(3).AddNode(msoSmartArtNodeBelow, msoSmartArtNodeTypeAssistant)

a node gets added at the top level - without any connection to the existing nodes.

(Dim saNode As SmartArtNode, MyOrgChart is a Shape in the ActiveSheet, AllNodes(3) is an existing node in the SmartArt)

Sub Macro3()
    For Each MyOrgChart In ActiveSheet.Shapes
        If MyOrgChart.HasSmartArt Then
            MyOrgChart.Select
            saNode = MyOrgChart.SmartArt.AllNodes(3).AddNode(msoSmartArtNodeBelow, msoSmartArtNodeTypeAssistant)
            Next
        End If
    Next
End Sub
0 Answers
Related