Classes and Userform: Passing it around

  • Thread starter Thread starter axwack
  • Start date Start date
A

axwack

I created a class and a userform. The userform has certain fields of
type dates, strings, etc. all of which I set a CLASS with propertieis.
The class is created by the userform. After the user fills out the
userform, I want the class so that I can use it within my worksheet
workflow to calculate values for the worksheet.

How do I get the class after the userform is closed? Does it exist in
memory and how do I access it?
 
You could expose a public property in the user form that you can use to point
to an object variable that is defined in the worksheet. In this way, the
userform would be manipulating an object that actually exists in the
worksheet. When the userform is unloaded, the object would still be
available in the worksheet.

Or, you can also declare the object variable with a global scope. For
example, in a module, declare it like this

Global obj as New YourClass

You can then access that variable anywhere in your VBA code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top