Using ADODB to access opened xls file

╄→гoц情女王★ 提交于 2019-11-29 11:23:19

This is actually a known bug, see: http://support.microsoft.com/default.aspx?scid=kb;en-us;319998&Product=xlw. Querying an open Excel workbook with VBA causes a memory leak to occur as the reference is not released even when closing the connection and clearing the object.

Your Excel version is 2007 or later?

if is use Microsoft.ACE.OLEDB.12.0 at provider and your problem is solved.

[]´s

You would be much better to open your Excel data source using the built in Excel reference, rather than an ADO connection e.g:

Dim xlApp As New Excel.Application
Dim xlWrkBk As Excel.WorkBook

xlApp.WorkBooks.Open FILENAME
Set xlWrkBk = xlApp.ActiveWorkbook

And then go from here instead

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!