PC Review


Reply
Thread Tools Rate Thread

Basic question - modules and class modules - what's the difference?

 
 
Mark Stephens
Guest
Posts: n/a
 
      7th May 2005
I just successfully implemented Jon Peltier's highlighting lines on a chart
modified and improved by Andy Pope. I notice that their instructions
included the insertion of a 'class module'. I've never used one before and
have no idea what it is really. Can someone let me know if it is something I
should learn about? ie does it yield significanimprovements in your
programming to use class modules?

Thanks for your help and advice, kind regards, Mark


 
Reply With Quote
 
 
 
 
Tom Ogilvy
Guest
Posts: n/a
 
      7th May 2005
Search this groups archives on google groups for Class Modules and Pearson
as author.

--
Regards,
Tom Ogilvy


"Mark Stephens" <(E-Mail Removed)> wrote in message
news:d5iebt$k6p$(E-Mail Removed)...
> I just successfully implemented Jon Peltier's highlighting lines on a

chart
> modified and improved by Andy Pope. I notice that their instructions
> included the insertion of a 'class module'. I've never used one before and
> have no idea what it is really. Can someone let me know if it is something

I
> should learn about? ie does it yield significanimprovements in your
> programming to use class modules?
>
> Thanks for your help and advice, kind regards, Mark
>
>



 
Reply With Quote
 
deko
Guest
Posts: n/a
 
      7th May 2005
> I just successfully implemented Jon Peltier's highlighting lines on a
chart
> modified and improved by Andy Pope. I notice that their instructions
> included the insertion of a 'class module'. I've never used one before and
> have no idea what it is really. Can someone let me know if it is something

I
> should learn about? ie does it yield significanimprovements in your
> programming to use class modules?


Class modules are used to create custom objects. Excel provides all the
objects most people need, so rarely will you need to create you own class
modules. Whatever you're doing with that chart must require custom
events/properties that have been encapsulated in the inserted class module.
The modules behind worksheets and user forms (and charts, etc) are built-in
class modules that give you access to the events/properties of those
objects.


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      7th May 2005

"deko" <(E-Mail Removed)> wrote in message
news:y54fe.8350$(E-Mail Removed)...
> Excel provides all the
> objects most people need, so rarely will you need to create you own class
> modules.


That's not true Deko. Excel provides most of the Excel objects, methods and
properties that we need (not all!), but they provide not business function
objects, so we need to create those. Class modules are ideal for that.


 
Reply With Quote
 
deko
Guest
Posts: n/a
 
      7th May 2005
> > Excel provides all the
> > objects most people need, so rarely will you need to create you own

class
> > modules.

>
> That's not true Deko. Excel provides most of the Excel objects, methods

and
> properties that we need (not all!), but they provide not business function
> objects, so we need to create those. Class modules are ideal for that.


Perhaps I should have said "I've never had to create my own class modules."
Out of curiosity, can you give me an example of the types of things class
modules are typically used for? What kinds of problems can they solve?
Perhaps I'll find somewhere to use one.


 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      7th May 2005
Personally, I'd stick with deko's analysis, since he said "most people".

I'd guess that the fraction of users of XL that have ever used a
non-standard object is less than 1%, and the fraction who've actually
created a "business function object" infinitesimally smaller.

The overwhelming majority of workbooks in the wild don't even contain a
*formula*!




In article <(E-Mail Removed)>,
"Bob Phillips" <(E-Mail Removed)> wrote:

> > Excel provides all the
> > objects most people need, so rarely will you need to create you own class
> > modules.

>
> That's not true Deko. Excel provides most of the Excel objects, methods and
> properties that we need (not all!), but they provide not business function
> objects, so we need to create those. Class modules are ideal for that.

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      7th May 2005

"deko" <(E-Mail Removed)> wrote in message
news:Zp4fe.8652$(E-Mail Removed)...
> Perhaps I should have said "I've never had to create my own class

modules."
> Out of curiosity, can you give me an example of the types of things class
> modules are typically used for? What kinds of problems can they solve?
> Perhaps I'll find somewhere to use one.


In the context of the point I was making, I am taking about business
objects, such as Organisation, locations, employees, etc., or something
along the lines of the purpose of the company, such as products, customers,
etc. You may notice that most (all) of these suggest a plural, and the
concept of a collection class is one of the most useful IMO.

As an example, I created an appointment for my wife a while back, that had a
class for the consultants, a class for the patients, and another
appointments class (probably a few more in there besides, but I don't
remember). One of the advantages of the class, over and above the stated
advantages such as encapsulation, was that I could create a simple test
harness for each class and prove it independently. Assuming my design
worked, plugging it all together at the end was a doddle.

Regards

Bob


 
Reply With Quote
 
Niek Otten
Guest
Posts: n/a
 
      7th May 2005
<The overwhelming majority of workbooks in the wild don't even contain a
*formula*!>

LOL-True!
In the company I used to work for, a staff share option scheme was
announced.
A colleague of mine issued a spreadsheet with which you could calculate your
possible profits under varying circumstances.
There appeared to be no formula at all; it was just a template that could
have been a paper one as well. Turned out that the colleague who had been
using Excel for years already (working in a budgeting department) wasn't
aware you could automate the calculations using formulas! Spreadsheet: paper
with a columns and rows layout.

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel


"JE McGimpsey" <(E-Mail Removed)> wrote in message
news:jemcgimpsey-(E-Mail Removed)...
> Personally, I'd stick with deko's analysis, since he said "most people".
>
> I'd guess that the fraction of users of XL that have ever used a
> non-standard object is less than 1%, and the fraction who've actually
> created a "business function object" infinitesimally smaller.
>
> The overwhelming majority of workbooks in the wild don't even contain a
> *formula*!
>
>
>
>
> In article <(E-Mail Removed)>,
> "Bob Phillips" <(E-Mail Removed)> wrote:
>
>> > Excel provides all the
>> > objects most people need, so rarely will you need to create you own
>> > class
>> > modules.

>>
>> That's not true Deko. Excel provides most of the Excel objects, methods
>> and
>> properties that we need (not all!), but they provide not business
>> function
>> objects, so we need to create those. Class modules are ideal for that.



 
Reply With Quote
 
deko
Guest
Posts: n/a
 
      7th May 2005
> > Out of curiosity, can you give me an example of the types of things
class
> > modules are typically used for? What kinds of problems can they solve?
> > Perhaps I'll find somewhere to use one.

>
> In the context of the point I was making, I am taking about business
> objects, such as Organisation, locations, employees, etc., or something
> along the lines of the purpose of the company, such as products,

customers,
> etc. You may notice that most (all) of these suggest a plural, and the
> concept of a collection class is one of the most useful IMO.
>
> As an example, I created an appointment for my wife a while back, that had

a
> class for the consultants, a class for the patients, and another
> appointments class (probably a few more in there besides, but I don't
> remember). One of the advantages of the class, over and above the stated
> advantages such as encapsulation, was that I could create a simple test
> harness for each class and prove it independently. Assuming my design
> worked, plugging it all together at the end was a doddle.


I can think of a recent situation where I have a collection of values used
for applying calculations, formatting, etc. I was thinking of putting all
that stuff in a separate worksheet and having code reference the sheet and
cell to make various user-requested changes in the other worksheets. I
suppose I could make that into a class and let the user select options from
a menu bar rather than monkey with that separate worksheet. But can I
insert a class module into a workbook via automation from Access?


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      8th May 2005

You an create a class template and import it into your project.

"deko" <(E-Mail Removed)> wrote in message
news:_K7fe.2485$(E-Mail Removed)...
> > > Out of curiosity, can you give me an example of the types of things

> class
> > > modules are typically used for? What kinds of problems can they

solve?
> > > Perhaps I'll find somewhere to use one.

> >
> > In the context of the point I was making, I am taking about business
> > objects, such as Organisation, locations, employees, etc., or something
> > along the lines of the purpose of the company, such as products,

> customers,
> > etc. You may notice that most (all) of these suggest a plural, and the
> > concept of a collection class is one of the most useful IMO.
> >
> > As an example, I created an appointment for my wife a while back, that

had
> a
> > class for the consultants, a class for the patients, and another
> > appointments class (probably a few more in there besides, but I don't
> > remember). One of the advantages of the class, over and above the stated
> > advantages such as encapsulation, was that I could create a simple test
> > harness for each class and prove it independently. Assuming my design
> > worked, plugging it all together at the end was a doddle.

>
> I can think of a recent situation where I have a collection of values used
> for applying calculations, formatting, etc. I was thinking of putting all
> that stuff in a separate worksheet and having code reference the sheet and
> cell to make various user-requested changes in the other worksheets. I
> suppose I could make that into a class and let the user select options

from
> a menu bar rather than monkey with that separate worksheet. But can I
> insert a class module into a workbook via automation from Access?
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
class modules versus modules Matt S Microsoft Excel Programming 1 12th Apr 2010 09:31 PM
Public Variables, Class Modules and Standard Modules Excel Monkey Microsoft Excel Programming 2 30th Apr 2009 03:18 PM
Question about class modules John Microsoft Access Getting Started 5 10th Oct 2007 12:00 AM
modules vs class modules =?Utf-8?B?cm9kbmV5?= Microsoft Access Getting Started 1 21st Mar 2004 02:47 AM
question on class modules George Microsoft Access VBA Modules 0 16th Jul 2003 05:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:22 AM.