I have a subroutine that adds an item to a Collection only if that item is not present. This effectively treats Collections as if they are sets. But VBA returns error 424 when the subroutine is called.
Private Sub SetUnion(ByVal e As String, ByVal Coll As Collection)
found = False
For n = 1 To Coll.Count
If Coll(n) = e Then
found = True
Exit For
End If
Next n
If found = False Then Coll.Add e
End Sub
当我打电话给我时
Dim s1, C As Collection
For n = 1 To s1.Count
SetUnion s1(n), C #
Next n
我
Run-time error ‘424’:
Object required
我做了哪些错误?