Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shared Class Modules??

Status
Not open for further replies.

cgraeter

Programmer
Sep 27, 2006
21
US
Hi All,

I have an Excel document that has a series of class modules in it that I'd like to have other workbooks hook into to use? I have tried to save it as a .xlam and then add a reference to it in the calling workbooks, but when I try to write code to access the class it does not seem to be able to see them (user defined function not defined). It can see code sitting in a normal module, but not class modules or forms.

Anyone have any ideas/suggestions on how I can share class modules across this?

Thanks in advance everyone!

Chris
 
Default class modules are private. In vba you can change them only to public not creatable.
The standard solution is setting instancing to 2 - PublicNotCreatable (to be able to get type available in declarations) and adding functions in referenced workbook that return new instances.
BTW, it's a good practice to replace default VBAProject name by an unique one, it's the library name in references.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top