ID: Q145852
The information in this article applies to:
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
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.
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:
1. Open the project file that you want the macro to reside in.
2. On the View menu, click More Views.
3. Click the Organizer button.
4. Select the Modules tab.
5. 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.
Additional query words: 4.00 4.10
Keywords : kbcode kbinterop kbprg
Version : 4.10 4.10a 98
Platform : WINDOWS
Last Reviewed: November 25, 1997