Module

  • Thread starter Thread starter Khalil Handal
  • Start date Start date
K

Khalil Handal

Hi,
What is the difference between Module and class module?
If I have a certain code in VBA, how do I know when to put it as class
module, module or in sheet or workbook?
Any explenation is highly appriciahted
 
Hi,
What is the difference between Module and class module?
If I have a certain code in VBA, how do I know when to put it as class
module, module or in sheet or workbook?
Any explenation is highly appriciahted

It's the same distinction that exists between function and object
oriented programming.

If you're writing a function, put it in a standard module
if you're writing a class, put it in a class module

standard module
A module containing only procedure, type, and data declarations and
definitions. Module-level declarations and definitions in a standard
module are Public by default. A standard module is referred to as a
code module in earlier versions of Visual Basic.

class module
A module that contains the definition of a class, including its
property and method definitions.

Brian Herbert Withun
 
Back
Top