overlapArr和uniqueOverlapArr都是具有多个变量的类对象“clsOverlap”。但是,下面的代码有运行时错误'438':OIbject不支持此属性或方法。
Dim i As Long
Dim j As Long
Dim k As Long
Dim uniqueOverlapArr() As clsOverlap
ReDim uniqueOverlapArr(0 To 1)
‘overlapArr is object array to remove duplications
For i = 0 To overlapArr.length - 1 ‘over 1mil indexes
If Not uniqueOverlapArr(0) Is Nothing Then ’check if first index is empty
For j = 0 To k
'CHECK DUPLICATION HERE
If (uniqueOverlapArr(j).grp_id = overlapArr(i).grp_id)) Then GoTo nxt
Next j
End If
Set uniqueOverlapArr(k) = New clsOverlap
uniqueOverlapArr(k) = overlapArr(i) ‘Error here 438
k = k + 1
ReDim Preserve uniqueOverlapArr(k)
nxt:
Next i
我不明白这里的错误,overlapArr以前被定义为clsOverlap
答案 0 :(得分:0)
编辑:发现问题,只需添加"设置"在出错之前