Symptoms
When you run a macro that uses the ADODB object in Microsoft Excel, you may receive an error message similar to the following:

Compile Error:
Invalid use of New keyword
Resolution
This problem occurs when all of the following conditions are true: You create a reference to both of the following libraries:Microsoft ActiveX Data Objects 2.1 LibraryMicrosoft DAO 3.6 Object LibraryMicrosoft DAO 3.6 appears before Microsoft ActiveX in the References dialog box.You explicitly refer to the ADODB object in a macro, for example:

Dim rs as ADODB.Recordset 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.