This is a general question regarding when a class has to be instantiated in Excel VBA. If I create a class object (let's call it oSession) in Userform_Initialize() can I use that instance of the class in other form procedures?
For example:
UserForm_initialize()
Dim oSession as New Session
with oSession
.Property1=Data1
.Property2=Data2
End with
End Sub
Does oSession go out of scope at "End Sub" or can I pass oSession to other procedures used by the form? My guess is that it goes out of scope, but I'm hoping there is a way to do it.
Hope I've used the right terminology, but, if not, I'm open to learning!
Svjack9
For example:
UserForm_initialize()
Dim oSession as New Session
with oSession
.Property1=Data1
.Property2=Data2
End with
End Sub
Does oSession go out of scope at "End Sub" or can I pass oSession to other procedures used by the form? My guess is that it goes out of scope, but I'm hoping there is a way to do it.
Hope I've used the right terminology, but, if not, I'm open to learning!
Svjack9