Passing user defined types between modules

Is it possible to pass user defined types between modules? I am receiving the following error message if I pass an instance of my type to a public sub: "User-defined types and fixed-length strings not allowed as the type of a Public member of an object module; Private object modules not allowed as the type of a public member of a public object modules", passing to a private sub in the same module is OK.

mark_sAsked:
Who is Participating?
 
gissingConnect With a Mentor Commented:
If you want to pass a UDT between two modules, the UDT has to be declared as public, so that both modules can see it.
0
 
anthonycCommented:
Classes can not have methods that have parameters using UDTs... if they are exposed (public).   To combat this, you can do one of 2 things:

1)  Build another class, which just has variables for your type, and pass that

2)  Build a collection to pass back and forth, using the KEY as the name of each variable


Mark's answer is wrong in this case..  He's correct for bas modules.
0
All Courses

From novice to tech pro — start learning today.