Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create class objects in excel

Status
Not open for further replies.

JTBorton

Technical User
Jun 9, 2008
345
DE
In excel I can create a class module to form my own object variables. Is it possible to link that class module to an object or object group?

For example:
I have used several shapes and lines and fancy squigglies to draw a basic diagram of a reactor column. Now I would like to turn this reactor picture into an actual object that I can use in code, like
reactor.type = "catalytic cracker"
reactor.tempF = 730
reactor.chemicals = 6
reactor.feed(1) = "Heavy Gas oil"...

Is there a way to link a class module to an actualy object or group?

-JTBorton
Another Day, Another Disaster
 
Perhaps I was not very clear in my question. I want to somehow attach that class module to the picture (or in this case a group of shapes), so that I can save that picture and class to use in future dates. Just like when you grab a text box, or combo box and slap it on an excel sheet or form. Each text box has a set of properties and methods. So when I am working on a project, and need to provide a visual layout, I can simply slap this saved reactor object, or saved heat exchanger object, or whatever it may be, on the form and it is ready to go with its own properties and methods. Just like adding a command button.

Does that make a little more sense?

-JTBorton
Another Day, Another Disaster
 
Hi JT

Maybe this will at least partially help you :

You could use a macro recorder to create your group of shapes,
and while recording you could assign other macros to particular objects from that group.

Let's say you drag&drop on your worksheet a circle and a square. You group them and assign macro A to the square and macro B to the circle. Clicking each of them will activate a different set of routines.

What you will get is a macro that will re-create your custom graphic object in one go and give your object access to some methods. Unfortunately the only type of event your object would be able to handle is "OnClick". Would that be enough? Do you need acces to any other type of events eg. "on mouse focus" etc. I am not sure if you could get any further going this route....

The other option could be something along these lines :

Create your shape, tell your macro that this shape is a "withevents" textbox/button etc and you might be able to access its methods. Again i am not sure if this would work but would be interested to hear how you got on with your project.

good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top