baneit319 发表于 2015-8-1 22:12:45

自定义一个函数运行时,出现自动化错误

调用下面这个函数时,总是出现自动化错误,请问错在哪里?
Function Sel_collection(startpoint() As Double, endpoint() As Double, selname As String)   
   Dim FilterType(0) As Integer
   Dim FilterData(0) As Variant
    Dim flag As Boolean
    Dim Sel_array As AcadSelectionSet

   FilterType(0) = 0
   FilterData(0) = "*POLYLINE"
    flag = False

For Each Sel_array In ThisDrawing.SelectionSets
If Sel_array.Name = selname Then
    flag = True
    Exit For
   End If
Next
If flag = True Then
   Sel_array.Delete
End If

Set Sel_array = ThisDrawing.SelectionSets.Add(selname)
    Sel_array.Select acSelectionSetCrossing, startpoint, endpoint, FilterType, FilterData

End Function

错误提示如下







baneit319 发表于 2015-8-2 12:45:07

啊哦,没人回?

baneit319 发表于 2015-8-4 12:35:25

大家帮忙看看,哪里有错误,谢谢!

zzyong00 发表于 2015-8-5 11:33:16

重新引用一下acad对象

baneit319 发表于 2015-8-6 09:07:00

zzyong00 发表于 2015-8-5 11:33 static/image/common/back.gif
重新引用一下acad对象

重新引用?这个怎么弄?我是出错后,把整个acad关了,然后再打开重新运行,也会跳出这个错误。

baneit319 发表于 2015-8-7 15:00:13

我自己再顶顶

baneit319 发表于 2015-8-8 16:49:57

在线坐等,已经好几天了哪位指点一下。

baneit319 发表于 2015-8-10 10:32:40

伟大的各位大虾,请帮忙指点一下呀

zzyong00 发表于 2015-8-10 21:23:50

http://www.baidu.com/baidu?word=vb+%E6%80%8E%E4%B9%88%E5%BC%95%E7%94%A8&ie=utf-8&tn=98012088_2_dg

baneit319 发表于 2015-8-17 21:45:34

zzyong00 发表于 2015-8-10 21:23 static/image/common/back.gif
http://www.baidu.com/baidu?word=vb+%E6%80%8E%E4%B9%88%E5%BC%95%E7%94%A8&ie=utf-8&tn=98012088_2_dg

我点进去后就成了百度搜索“VB怎么引用”不大明白,是我引用有问题?
页: [1] 2
查看完整版本: 自定义一个函数运行时,出现自动化错误