Referencing an object declared in a form outside that form

tfurnivall

New Member
Joined
Jan 15, 2012
Messages
48
I have an object declared in a user form as:
VBA Code:
Public Config as SysConfig
, where SysConfig is a class that defines a (fairly standard) configuration class.

I'm trying to reference this configuration object in a different module, and it throws an Undeclared Object error.

Is it possible to reference in a regular module a class defined in a UserForm?

Thanks,

Tony

PS - And, obviously, if som how?!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Yes, as long as that form is loaded and the object valid. You refer to it as a member of the form: userform.Config for example.
 
Upvote 0
Solution
Ah!
Yes - now I remember. I must admit I was hoping for an unqualified reference (ie if it's a Public declaration, the name should be enough, right?), but this gets the job done.

Thanks RoryA
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,980
Members
448,934
Latest member
audette89

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