nodRoot.TextShape.TextFrame.Characters.Caption = "hi"出现类不支持自动化错误
Dim intCount As Integer
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim nodRoot As Excel.DiagramNode
Dim shDiagram As Excel.Shape
Dim shText As Excel.Shape
' Set shText = New Excel.Workbook
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
' xlSheet.Cells(1, 1) = "Hi"
xlApp.DisplayAlerts = False
Set shDiagram = xlSheet.Shapes.AddDiagram(msoDiagramOrgChart, 10, 15, W, H)
Set nodRoot = shDiagram.DiagramNode.Children.AddNode
nodRoot.TextShape.TextFrame.Characters.Caption = "hi"
For intCount = 1 To 10
nodRoot.Children.AddNode
Next intCount