I have created in VBA class that contains a collection of objects. When I try to add objects via a method that I have created I'm getting:
"438 - object dosen't support this property or method vba"
even if the method exist on my class.
myCronCol is an instance of the CronCol class defined here:
Private Sub Class_Initialize()
Call InstanceProfiler.AddInstance(Me)
Set myCol = New Collection
End Sub
Private Sub Class_Terminate()
On Error GoTo Class_Terminate_Err
DoEvents
Call InstanceProfiler.RemoveInstance(Me)
Exit Sub
Class_Terminate_Err:
Call Log.add(e_ltError, "Class_Terminate", Err.Description)
Resume Next
End Sub
Public Sub addElement(ByRef cronElement As ClsCron)
myCol.add cronElement
End Sub
myCol is declared in a modul as public variable and is being initialized when the master object is initialized.
Dim myCol As Collection
...
Public Sub addElement(ByVal cronElement As ClsCron)
myCol.add cronElement
End Sub
Dim Cron as ClsCron
Set Cron = new ClsCron
'some constructors
Cron.Init("abba","banana")
Here the error apears:
myCronCol.addElement (Cron)
What I'm doing wrong? :-(