Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Class Modules vs Modules

Hi ,

Can someone please explain in laymen's terms the difference between the two?

The advantage of a class module over a module ?

Is there any special requirements that a class module needs over a module?

Thanks for your help.
Jeff


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Class Modules vs Modules

Although class modules aren't discussed extensively, this may provide what
you need to know:

From Chip Pearson's site:

http://www.cpearson.com/excel/codemods.htm
where to put your code

--
Regards,
Tom Ogilvy

Jeff Marshall wrote in message
...
Hi ,

Can someone please explain in laymen's terms the difference between the

two?

The advantage of a class module over a module ?

Is there any special requirements that a class module needs over a module?

Thanks for your help.
Jeff




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Class Modules vs Modules

Jeff,

The short answer is that if you have to ask the difference between modules
and class modules, don't use class modules. Put all your code in standard
modules.

The longer answer is that you use class modules to create your own objects.
Objects are defined by their properties, methods, and events -- all of which
are placed in the class module -- and then defined in to existence with the
Set New syntax. If you are familiar with Type variables (called Structures
or Structs in other programming languages), you can think of a class as a
"Type With Code". You use Property Let/Get/Set statements to define the
properties (variables) of the class, and then add code with Subs and
Functions. Once you've defined all the properties and methods in the class
module, you create an object variable (or "instance") of that class with
code like

Dim X As Class1
Set X = New Class1

A full discussion of how (and when) to use classes is beyond the scope of a
newsgroup post. A good book on VBA should provide at least the basics.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Jeff Marshall" wrote in message
...
Hi ,

Can someone please explain in laymen's terms the difference between the

two?

The advantage of a class module over a module ?

Is there any special requirements that a class module needs over a module?

Thanks for your help.
Jeff




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB Modules dhstein Excel Discussion (Misc queries) 9 November 8th 08 09:46 PM
Help with modules. Cloudy New Users to Excel 1 June 17th 08 10:10 AM
Naming class modules in Excel 2002 bryan Excel Discussion (Misc queries) 2 December 13th 04 11:42 AM
Class Modules Siphuncle Excel Programming 2 August 12th 03 06:37 PM
Event - RaiseEvents Within Class Modules John Peterson[_3_] Excel Programming 4 July 17th 03 12:53 AM


All times are GMT +1. The time now is 07:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"