ef2000斑竹,麻烦您找找错
Public Sub autoexample()Dim acadobj As AcadObject
Dim line As AcadLine
'Dim startpt As Variant '保存直线起始点
'Dim endpt As Variant '保存直线终点
Dim i As Integer
For i = 0 To retobj.ModelSpace.Count - 1
Set acadobj = retobj.ModelSpace.Item(i)
MsgBox acadobj.ObjectName
Select Case acadobj.ObjectName
Case "AcDbline"
Set line = retobj.ModelSpace.Item(i)
MsgBox line.StartPoint(0)
End Select
next i
end
retobj定义为全局变量acaddocument,在VB环境下
为什么语句执行到for i=o to retobj.modelspace.count-1时,出错“对象变量或with块变量未设置”谢谢
有没有这样定义过Dim retobj As AcadDocument
谢谢mccad回复,定义了retobj为全局变量
是的,public retobj as acaddocument
再求教一个问题:thisdrawing.application.document.open name为何不能使用
在多文档状态下,必须使用documents.open,而单文档时才能使用document.open
具体请见帮助文件的链接
file:///D:/program/vba/acadauto/acadauto/idx_methods.htm#gloss_m1o
页:
[1]