|
楼主 |
发表于 2024-10-2 13:06
|
显示全部楼层
'创建组织结构图,并向中间的图表节点添加子节点
Sub AddChildrenToMiddle2()
Dim dgnRoot As DiagramNode, dgnNext As DiagramNode
Dim shpDiagram As Shape
Dim intCount As Integer
Set shpDiagram = ActiveDocument.Shapes.AddDiagram _
(Type:=msoDiagramOrgChart, Left:=10, _
Top:=15, Width:=400, Height:=475)
Set dgnRoot = shpDiagram.DiagramNode.Children.AddNode
Set shpText = shpDiagram.DiagramNode.Children(1).TextShape
shpText.TextFrame.TextRange.Text = "2024年国庆节"
For intCount = 1 To 3
dgnRoot.Children.AddNode
Set shpText = dgnRoot.Children(intCount).TextShape
shpText.TextFrame.TextRange.Text = "2024年国庆节" & intCount
Next intCount
Set dgnNext = dgnRoot.Children(1).NextNode
For intCount = 1 To 4
dgnNext.Children.AddNode
Set shpText = dgnNext.Children(intCount).TextShape
shpText.TextFrame.TextRange.Text = "2024年国庆节" & intCount
Next intCount
End Sub
|
|