guoxianlun 发表于 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 = " activex/vba" '设置字符串
Set textObject = ThisDrawing.ModelSpace.AddText_(textstr, textpoint, TextHeight)
ThisDrawing.Application.ZoomExtents
textObject.Update
End Sub
以上代码是一本书上的示例,但我试着运行后出现红字的语句错,提示错误代码"438",对象不支持该属性或方法。在CAD2004和2007版运行均是同样的情况。
请问是什么原因?

guoxianlun 发表于 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
页: [1]
查看完整版本: [求助]这段代码为何运行不了?