What Triggers a Class Module to be Read?

cyber553

New Member
Joined
Nov 9, 2015
Messages
1
I've been coding in Excel VBA for a while, but am fairly new to using Class Modules.

One of the classes I have created depends on another user-defined class that is defined in an add-in that only a few employees at my firm have. My issue is that whenever someone who doesn't have this add-in opens my workbook, Excel gives a VBA error because it can't find the class that is defined in the add-in they don't have.

I can't figure out why, when a user simply opens my workbook, Excel seems to read/execute my class module (when it executes the code looking for the add-in most users don't have). Does anyone know what events, specifically, would cause my class module to be read/executed?

In case it is relevant, I am currently instantiating this add-in specific class using a "Dim WithEvents" statement at the top of my class. I have tried moving this statement inside of the class's Intialize() method, thinking this would cause that line only to be executed when my class is actually instantiated, however, this gives a compiler error.

Any help would be much appreciated!

James
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,215,131
Messages
6,123,223
Members
449,091
Latest member
jeremy_bp001

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