View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
TomHinkle TomHinkle is offline
external usenet poster
 
Posts: 36
Default what can classmodules do

you'll still have to copy a class module from one project to another..
Stick to modules.

A class module pretty much codes the same as a regular module, but using it
is WAY different.

you use a class to define something you're going to make more and more of.

For an example (programmers, realize I'm simplifying the description here).

A worksheet is an example of a class.

you can write

dim X as worksheet

set X = new worksheet

then use X as if it were a variable.

In your program try this in a class module


Name it myclass

put this code in it

public X as long
public Y as long




then in a code module write this

dim FirstTest as myclass
dim SecondTest as myclass

set firstTest = new myclass
set secondTest = new myclass

firstTest.x = 5
SecondTest.x = 10

debug.print "first " & firstTest.x
debug.print "second " & secondtest.x






"sybmathics" wrote:

Hi,

I am programming slotmachine-algorythms in excel to find a way to become
rich without working.

I know how to create a user interface, to create modules and connecting
subroutines, to create functions. However, I keep stumbling on the fact that
when I have created a subroutine for one programme and want to use this for
a next programme, I need to copy and paste the routine.

Is there a way out of this?

When I look at the helpdescription of classmodules I figure this could be of
some help, but when I'm in such a classmodule I don't know what to do.


Any help is greatly appreciated,

greets,

Sybolt