Article ID: 225059 - Last Review: October 11, 2006 - Revision: 3.2 XL2000: "Invalid Use of New Keyword" Error Using ADODB Object Library
This article was previously published under Q225059 For a Microsoft Excel 2002 version of this article, see 291199
(http://support.microsoft.com/kb/291199/EN-US/
)
.
On This PageSYMPTOMS
When you run a macro that uses the ADODB object, you may receive an error message similar to the following:
Compile Error:
Invalid use of New keyword CAUSE
This problem occurs when all of the following conditions are true:
WORKAROUND
To work around this problem, use either of the following methods.
Method 1: Remove the Reference to DAOIf you do not need the reference to Microsoft DAO 3.6 Object Library, follow these steps to remove the reference:
Change the Priority of the ADO ReferenceChange the priority in which the ADO object library is referenced by placing the reference to Microsoft ActiveX 2.1 before the Microsoft DAO 3.6 Object Library.To change the priority, follow these steps:
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. MORE INFORMATION
In Microsoft Visual Basic, you can reference both the Microsoft DAO 3.6 Object Library (DAO) and Microsoft ActiveX Data Objects 2.1 Library (ADO) in a single project. The library for DAO is Dao360.dll and for ADO, Msado15.dll. However, if you reference both libraries in the same project, Visual Basic may not refer to the correct library when you make the connection or create the recordset object, because both libraries contain similar object names. To avoid these kinds of problems, you can use the program ID name contained in the object library when you declare variables in your project. However, creating a reference to both libraries requires that you reference ADO before the DAO library. The following examples create a variable for a recordset in both DAO and ADO, by using the program ID object:
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top
