Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Classes and Userform: Passing it around

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Classes and Userform: Passing it around

Declare the class in the code that launches the userform, then pass the
class to the userform as a property. Here's a simple example of userform
properties:

http://peltiertech.com/Excel/PropertyProcedures.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"axwack" wrote in message
ps.com...
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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing value to userform quetion Doug Glancy Excel Programming 0 December 1st 06 09:02 PM
Passing Procuedure to Userform Nigel Excel Programming 4 September 10th 05 05:22 PM
Passing variables between Sub and Userform jose luis Excel Programming 8 July 22nd 05 05:20 PM
Passing variables from module to userform Chris Dunigan Excel Programming 4 November 26th 03 09:37 AM
Passing a value to a variable from Userform Neal Steiner Excel Programming 1 July 18th 03 09:12 PM


All times are GMT +1. The time now is 06:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"