明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 921|回复: 1

[求助]这段代码为何运行不了?

[复制链接]
发表于 2008-2-25 17:35:00 | 显示全部楼层 |阅读模式

Private Sub CommandButton1_Click()
Dim textpoint(0 To 2) As Double '声明文字插入点
Dim texthight As Double
Dim textstr As String
Dim textObject As AcadText
textpoint(0) = 20
textpoint(1) = 40
textpoint(2) = 0
texthigh = 10
textstr = "AutoCAD activex/vba" '设置字符串
Set textObject = ThisDrawing.ModelSpace.AddText_(textstr, textpoint, TextHeight)
ThisDrawing.Application.ZoomExtents
textObject.Update
End Sub

以上代码是一本书上的示例,但我试着运行后出现红字的语句错,提示错误代码"438",对象不支持该属性或方法。在CAD2004和2007版运行均是同样的情况。

请问是什么原因?

 楼主| 发表于 2008-2-25 17:50:00 | 显示全部楼层
Private Sub CommandButton1_Click()
Dim textpoint(0 To 2) As Double 'ÉùÃ÷ÎÄ×Ö²åÈëµã
Dim texthEight As Double
Dim textstr As String
Dim textObject As AcadText
textpoint(0) = 20
textpoint(1) = 40
textpoint(2) = 0
texthEight = 10
textstr = "autocad activex/vba" 'ÉèÖÃ×Ö·û´®
'chuanjjjjj
Set textObject = ThisDrawing.ModelSpace.AddText(textstr, textpoint, texthEight)
ThisDrawing.Application.ZoomExtents
textObject.Update
End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 11:55 , Processed in 0.157834 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表