PRJ: "User-Defined Type Not Defined" Error in Macro (145852)
The information in this article applies to:
- Microsoft Project 98 for Windows
- Microsoft Project for Windows 95 4.1
- Microsoft Project for Windows 95 4.1a
This article was previously published under Q145852 SYMPTOMS
When you try to declare a variable of the type "Database" that is available
with the data access object (DAO) library, you may receive the following
error message:
User-defined type not defined
CAUSE
Microsoft Project can make use of the DAO Object Library that Microsoft
Excel and Microsoft Access install. The DAO Object Library defines a
variable of the type "Database." The error is generated because there is a
hidden module in Microsoft Project called "Database." This module name
conflicts with the built-in object type defined by DAO.
RESOLUTION
This error does not occur if you declare your variable type as "Variant"
instead of "Database." For example, instead of using the following
declaration:
Dim oData As Database
Use the following:
Dim oData as Variant
This error also does not occur if the macro that is being created is stored
in a project file (.mpp). To copy a macro from the default storage location
of the Global.mpt to a specific project file, use the Organizer within
Microsoft Project as follows:
- Open the project file that you want the macro to reside in.
- On the View menu, click More Views.
- Click the Organizer button.
- Select the Modules tab.
- Copy the Module that the macro resides in from the Global.mpt side
of the Organizer to the project file side of the Organizer.
The macro will no longer cause the error.
Modification Type: | Major | Last Reviewed: | 10/7/2003 |
---|
Keywords: | kbcode kbinterop kbProgramming KB145852 |
---|
|