View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Using Instances of a Class

Stig,
Declare you class instance in a module, so it is globally available.

You can't use them on a worksheet, as they are object, so you cannot pass
them to UDF.
But you can pass them to a VBA function.

'assume this is you global variable that has suitably instantiated
Public MyInst as MyClass

'and you have function in a module
Public Function DoSomeWork(argIn as MyClass) As Long
With argIn....etc
End Function

You can call it with
Call DoSomeWork(MyInst)

Not sure what you mean "hell" in this case.

NickHK

"STIG" wrote in message
...
Hi!
I have a class Person, wich have it`s own properties and functions. When
creating instances of such a class, I would like to have them globally
avalable in excel, so that I can use them as input arguments in general
module UDF`s. Later on I would like to create controls for some of their
properties by means of some UserForm. After I have created an object, wich
hell do they recide in, and how can I get a hold of them. Can I make my

own
hell to store them in? And how do I pass them to a function from a
spreadsheet cell using "=function()" syntax?

Novice Norwegian