nodRoot.TextShape.TextFrame.Characters.Caption = "hi"出现类不支持自动化错误

stoneheng 2007-06-17 09:40:06
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
...全文
226 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
knowledge_Is_Life 2008-05-01
  • 打赏
  • 举报
回复
不明LZ在说什么
lyhyp 2007-09-25
  • 打赏
  • 举报
回复
nodRoot.TextShape.TextFrame.Characters.Caption = "hi"


改成

nodRoot.TextShape.TextFrame.textRange.text = "hi"

2,463

社区成员

发帖
与我相关
我的任务
社区描述
VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区管理员
  • VBA
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧