I have an introduction to classes on my web site at
http://www.cpearson.com/excel/Classes.aspx. A class module is used to
present an abstraction of anything you need to work with in your
program. For example, for a office productivity application, you need
to deal with people. You would create a class named CPerson, give it
properties (which are like adjectives -- they describe attributes such
as Name, Address, Salary) and give it methods (which are like verbs --
they carry out actions, like PrintPaycheck). Once you have a class,
you create instances of the class called object (Dim Pawn As CPerson,
Dim Boss As CPerson) and you can pass those objects around within an
application, and the code that uses them need not know the internals
of how a class is implemented. The code can simply examine the
appropriate properties or carry out the various methods while being
peacefully oblivious to all else that makes up the class.
If you programmed with structures (also called structs or records), a
class is like a structure except that it executes code in addition to
simply storing data value in an organized way.
Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
The San Diego Project Group, LLC
(email is on the web site)
USA Central Daylight Time (-5:00 GMT)