Article ID: 319998 - View products that this article applies to.
This article was previously published under Q319998
When you retrieve a Microsoft ActiveX Data Objects (ADO) Recordset from an Excel worksheet that is open in Excel, a memory leak occurs in the Excel process. Repeated queries may eventually cause Excel to run out of memory and raise an error, or cause Excel to stop responding.
The memory used by the ADO queries cannot be reclaimed by closing and releasing the ADO objects. The only way to release the memory is to quit Excel.
If possible, query the Excel worksheet only while the file is not open in Excel.
If the worksheet must remain open (for example, to allow dynamic recalculation of worksheet values on an ongoing basis) use one of the following methods to work around the behavior:
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Steps to Reproduce the Behavior
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
257819For additional information about the use of performance counters from Visual Basic, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/257819/ )How To Use ADO with Excel Data from Visual Basic or VBA
296526For additional information about Excel export options, click the article numbers below to view the articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/296526/ )INFO: Collecting Performance Data Using PDH APIs from Visual Basic
(http://support.microsoft.com/kb/247412/EN-US/ )INFO: Methods for Transferring Data to Excel from Visual Basic
(http://support.microsoft.com/kb/246335/ )How To Transfer Data from an ADO Recordset to Excel with Automation
Article ID: 319998 - Last Review: February 12, 2007 - Revision: 3.3