1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
Sub Créer_graphique()
Dim oSALayout As SmartArtLayout
Dim QNodes As SmartArtNodes
Dim QNode As SmartArtNode
Set oSALayout = Application.SmartArtLayouts(92)
Set oShp = ActiveWorkbook.ActiveSheet.Shapes.AddSmartArt(oSALayout)
Set QNodes = oShp.SmartArt.AllNodes
For i = 1 To 5 'supprime toutes les nodes de base
oShp.SmartArt.AllNodes(1).Delete
Next
Set QNode = oShp.SmartArt.AllNodes.Add 'ajoute une node
QNode.TextFrame2.TextRange.Text = "Stéfanie" 'ecris le texte
Call Créer_Fils(QNode)
End Sub
Sub Créer_Fils(Parent As SmartArtNode)
Dim FNode1 As SmartArtNode
Dim FNode2 As SmartArtNode
'va créer deux fils à mon parent
Set FNode1 = Parent.AddNode(msoSmartArtNodeBelow)
FNode1.TextFrame2.TextRange.Text = "de"
Set FNode2 = Parent.AddNode(msoSmartArtNodeBelow)
FNode2.TextFrame2.TextRange.Text = "monaco"
End Sub |