A class module is used to encapsulate a variety of data about a particular
entity into a single entity. For example, imagine you are writing an
application that does something with employees. You could create a class
called CEmployee that would have data items for name, address, phone, etc. A
class can also contain methods (Subs and Functions), so your CEmployee class
might have a method that prints the employee's paycheck. In your
application, you would create a new instance variable of the CEmployee class
for each employee you are dealing with. By using a class to represent one
employee, you can use a single variable to represent all the various
attributes of an employee. In a large and complicated application, it is
MUCH easier to deal with one variable, a variable of type CEmployee, that
wraps up all the information than it is to deal with many separate,
unrelated variables. Without classes, you'd probably end up with a number of
arrays that would have to be kept in sync with one another, a task that can
quickly get quite complicated.
This other programmer is not known for concise code.
My experience over the years has been that using classes doesn't have a
profound effect on the number of lines of code in a project. In the big
picture, classes neither increase nor decrease the number of lines of code
in a project (but using lines of code as a measure of anything is rather
inane). Classes can have a very positive effect by simplifying and
streamlining the logic of the application.
For a much more in depth look at classes with example, see
www.cpearson.com/Excel/Classes.aspx
--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)