Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Passing user defined types between modules

Posted on 1998-07-24
2
Medium Priority
?
298 Views
Last Modified: 2010-05-03
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.

0
Comment
Question by:mark_s
2 Comments
 
LVL 1

Accepted Solution

by:
gissing earned 50 total points
ID: 1466584
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
 
LVL 6

Expert Comment

by:anthonyc
ID: 1466585
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

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question