ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Instances of a Class (https://www.excelbanter.com/excel-programming/380510-re-using-instances-class.html)

NickHK

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





All times are GMT +1. The time now is 04:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com