|
发表于 2024-10-1 15:59
来自手机
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
dongdonggege 发表于 2024-10-1 09:40
哪位老师教我,谢谢。
'Word365组织结构图简单示例如下
'Word03可以参考一下
Sub Word365组织结构图()
Dim app As Application
Dim shp As Shape, stm As SmartArt
Set app = Application
With app.ActiveDocument
Set shp = .Shapes.AddSmartArt( _
app.SmartArtLayouts(1), _
10, 10, 200, 100)
Set stm = shp.SmartArt
k = 1
For Each Nd In stm.Nodes
Nd.TextFrame2.TextRange.Text = k
k = k + 1
Next
End With
Set shp = Nothing
Set stm = Nothing
Set app = Nothing
End Sub |
|