davidd31415
Programmer
I'm trying to return a user-defined class object from a different user-defined class function and am getting an "object variable or with block variable not set" error after the object initializes.
I've tried using both Property Get and Functions, both in this form:
Public Function GetDateTime() As DataPointClass
GetDateTime = New DataPointClass
GetDateTime = DateTime
End Function
(or Public Property Get GetDateTime() As DataPointClass)
Where DateTime is a local DataPointClass Object. If I leave out the GetDateTime = New DataPointClass line, the same error is raised. When stepping through, the DataPointClass Initialize() method is executed and the error is raised when that function ends.
Any ideas how I can do this? I believe in C++ I'd need to use pointers, this is the first time I've ever tried something like this with VBA.
Thanks,
Dave
I've tried using both Property Get and Functions, both in this form:
Public Function GetDateTime() As DataPointClass
GetDateTime = New DataPointClass
GetDateTime = DateTime
End Function
(or Public Property Get GetDateTime() As DataPointClass)
Where DateTime is a local DataPointClass Object. If I leave out the GetDateTime = New DataPointClass line, the same error is raised. When stepping through, the DataPointClass Initialize() method is executed and the error is raised when that function ends.
Any ideas how I can do this? I believe in C++ I'd need to use pointers, this is the first time I've ever tried something like this with VBA.
Thanks,
Dave