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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top