-
Hello!
I have a little problem with my collection object. When I try to add something to it, I get an error (91: Object variable or With variable not set.)
Here's the code I use:
Code:
Type Vpr
vVpra As Collection
oOdgo As Collection
End Type
Public kVpr As Vpr
Sub Add(str1, str2)
With kVpr
.vVpra.Add str1
.oOdgo.Add str2
End With
End Sub
What have I done wrong?
As much as I know there should be no errors. Or I forgot something?
-
Hi,
You need to declare a new instance of your collections
Code:
Type Vpr
vVpra As New Collection 'Declare new instance
oOdgo As New Collection 'of the collection object
End Type
Public kVpr As Vpr
Sub Add(str1, str2)
With kVpr
.vVpra.Add str1
.oOdgo.Add str2
End With
End Sub
Hope this helps
Shaun
-
Collections must be declared, too?
I didn't know.
Thanks.