PRB: Add Method of QueryTables with Excel Automation Generates Run-time Error Message "5" (263498)
The information in this article applies to:
- Microsoft Excel 2000
- Microsoft Excel 2002
- ActiveX Data Objects (ADO) 2.5
- ActiveX Data Objects (ADO) 2.6
This article was previously published under Q263498 SYMPTOMS When you automate Microsoft Excel, if you call the Add method of the QueryTables collection and supply an ADO recordset for the Connection argument, you receive the following error message at run
time: Run-time Error '5': Invalid procedure
call or argument CAUSE The problem is caused by the manner in which ActiveX Data
Objects (ADO) uses marshalling for recordsets. ADO server-side cursors do not
marshal cross-process. RESOLUTION To work around this problem, do the following:
- Use a client-side cursor. -or-
- Use another technique for transferring the recordset to
Excel. See the "References" section of this article for resources.
REFERENCESFor additional information regarding different techniques for
transferring data to Excel from an external source, click the article numbers
below to view the articles in the Microsoft Knowledge Base: 247412 INFO: Methods for Transferring Data to Excel from Visual Basic
246335 HOWTO: Transfer Data from ADO Recordset to Excel with Automation
Modification Type: | Major | Last Reviewed: | 12/15/2003 |
---|
Keywords: | kbAutomation kbprb kbProgramming KB263498 |
---|
|