View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default Classes and Userform: Passing it around

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.



--
Hope that helps.

Vergel Adriano


"axwack" wrote:

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?