明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1402|回复: 0

请教VBA问题

[复制链接]
发表于 2012-3-16 11:56:44 | 显示全部楼层 |阅读模式
请教各位老师:
下面代码在运行第二遍时出现致命错误。是为什么?
谢谢!
Sub Example_Select()
   
    Dim SSetColl As AcadSelectionSets
    Set SSetColl = ThisDrawing.SelectionSets
   
    Dim ssetObj As AcadSelectionSet
   
    If SSetColl.Count > 0 Then
   
        For Each obj In ThisDrawing.SelectionSets
            obj.Delete
        Next 'obj
    End If
   
    Set ssetObj = SSetColl.Add("SSET")
   
    Dim mode As Integer
    Dim corner1(0 To 2) As Double
    Dim corner2(0 To 2) As Double
   
    mode = acSelectionSetCrossing
    corner1(0) = 10: corner1(1) = 286: corner1(2) = 0
    corner2(0) = 94: corner2(1) = 291: corner2(2) = 0
    ssetObj.Select mode, corner1, corner2
   
    Dim txt As AcadEntity
    Dim tx As AcadMText
    For Each txt In ssetObj
    If txt.ObjectName = "AcDbMText" Or txt.ObjectName = "AcDbText" Then
       Debug.Print txt.ObjectName & "内容" & txt.TextString
    End If
   
    Next

   
End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 18:37 , Processed in 0.144165 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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