以下是引用sheyg在2005-4-18 17:15:00的发言:
如题,请高人指点!
WORD目前不是特别支持开发组织结构图.
使用录制宏,无法取得相关参数.
以下代码供参考:
'* +++++++++++++++++++++++++++++
'* Created By I Love You_Word!@ExcelHome 2005-4-18 17:55:11
'仅测试于System: Windows NT Word: 10.0 Language: 2052
'^The Code CopyIn [ThisDocument-ThisDocument]^'
'* -----------------------------
Sub ExampleToCanvas()
Dim shpCanvas As Shape, shpCanvasShapes As CanvasShapes
Dim shpCnvItem As Shape
On Error Resume Next '此处必需,忽略错误
Application.ScreenUpdating = False '关闭屏幕更新
For Each shpCanvas In ActiveDocument.Shapes '在本文档中图形中循环
If shpCanvas.Type = 21 Then '如果为组织结构图
Set shpCanvasShapes = shpCanvas.CanvasItems '定义为一个画布集合
For Each shpCnvItem In shpCanvasShapes '在画布的每一个图形中循环
With shpCnvItem.TextFrame.TextRange.Font '对于图形文字
.Name = "Tahoma" '此处指定字体
.Size = 12 '此处指定字号
.Bold = True '此处指定粗体
.Color = wdColorRed '此处指定字体颜色
End With
Next
End If
Next
Application.ScreenUpdating = True '恢复屏幕更新
End Sub
'----------------------
注意:您的WORD的宏安全性必须为低,如果为非低,请设为低后重启WORD.
请点击菜单最右侧的"ExamplToCanvas"命令按钮.
s1zAiQKP.zip
(14.64 KB, 下载次数: 59)
|