XL2000: "Invalid Use of New Keyword" Error Using ADODB Object Library (225059)
The information in this article applies to:
This article was previously published under Q225059 For a Microsoft Excel 2002 version of this article, see 291199.
SYMPTOMS
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:
NOTE: This problem does not occur when you use the DAO object, and Microsoft DAO 3.6 appears after Microsoft ActiveX in the References dialog box.
WORKAROUND
To work around this problem, use either of the following methods.
Method 1: Remove the Reference to DAO
If you do not need the reference to Microsoft DAO 3.6 Object Library, follow these steps to remove the reference:
- In the Microsoft Visual Basic Editor, click References on the Tools menu.
- In the References dialog box, click to clear the Microsoft DAO 3.6 Object Library check box.
- Click OK.
Change the Priority of the ADO Reference
Change 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:
- In the Microsoft Visual Basic Editor, click References on the Tools menu.
- In the References dialog box, click Microsoft ActiveX Data Objects 2.1 Library.
- Use the Priority buttons to move the reference up the list until is appears before the reference to the Microsoft DAO 3.6 Object Library.
- Click OK.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbbug kbdtacode kberrmsg kbpending kbProgramming KB225059 |
---|
|