What are Class Modules

BizBoy

Board Regular
Joined
Jul 26, 2012
Messages
118
Hi,

I am new to MS Access and have never used Class module in Excel VBA either.
My question is more regarding Access, can anyone please help me understand what are class modules.

How they are different from regular modules.
What are the advantages of a class module or why and when should we use it.

Can anyone please help me in this.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Class modules generally fit into an object oriented paradigm. You might create a class to represent an object that has many different attributes (perhaps something like a "Product" with attributes like Price, Size, ComponentList, ProductID, and Weight.

With a class you must instantiate the object before you can use it:
Dim my_object as new MyObject().

More explanation:
https://www.mrexcel.com/archive/vba/difference-between-module-and-class-module/

There are many tutorials online if you goodle VBA Class Module.
 
Upvote 0
Technically, the module behind a form or report is a class module. A standard module would be one that contains code but doesn't "belong" to any object, be that a form, report or custom object. A custom class not only can create an object and give it properties, it can also give the object methods.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top