VBA Classes

Jameo

Active Member
Joined
Apr 14, 2011
Messages
270
Hi all,

I am attempting to use some classes to group together a number of option and check boxes on my forms.

Does anyone have a link handy with an introduction explaining their usage? I have found some examples of code in various places, but would ideally like a little bit of a narritive along with the code.

Many thanks
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I'm just getting an error:

User-defined type not defined

on:

Public EventTrapper As EventsTrapper

Any ideas why this would be?

I should add that I modified the code slightly for OptionButton as oppose to CommandButton, but I guess this should be fine?
 
Last edited:
Upvote 0
Then you must change everywhere CommandButton to OptionButton: in ThisWorkbook module and in class module.
 
Upvote 0
Hi Sektor, I believe I did that. However, because it was possible I made a mistake, I copied the code exactly as written in this thread and I am stillr eceiving the same error.

Sorry about this
 
Upvote 0
I'm just getting an error:

User-defined type not defined

on:

Public EventTrapper As EventsTrapper

Any ideas why this would be?

I should add that I modified the code slightly for OptionButton as oppose to CommandButton, but I guess this should be fine?

That error indicates that the code can't find the Class module.
Make sure the Class module has exactly the name of EventsTrapper. You can do that via the VBE Properties window.
 
Upvote 0
Also, you can trap Application and chart events. :)
Applications events - events that are raised by Excel instance. For instance, you can handle "NewWorkbook" event which is raised when new workbook is created.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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