Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
Is there a way to release the memory taken by a Recordset Object or a Connection ? Because everytime I run the code below it takes about 2 mb of my ram. Public Sub Simulation3() strPathExcelFile_FILTER = ThisWorkbook.FullName Set objConnection = CreateObject("ADODB.Connection") Set objRecordSet = CreateObject("ADODB.Recordset") objConnection.Open = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & strPathExcelFile_FILTER & ";" & _ "Extended Properties=Excel 8.0;" objRecordSet.Open "SELECT COUNT(*) AS resultat FROM [SHEET1$A1:IV20] WHERE [PX_LAST] 20", objConnection, adOpenForwardOnly, adLockReadOnly Simulation.Label2.Caption = objRecordSet.fields("resultat") objRecordSet.Close objConnection.Close Set objConnection = Nothing Set objRecordSet = Nothing End Sub Thanks in advance. Regards, |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nader,
Check here for suggested workarounds: http://support.microsoft.com/kb/319998 -- Hope that helps. Vergel Adriano "Nader" wrote: Hello, Is there a way to release the memory taken by a Recordset Object or a Connection ? Because everytime I run the code below it takes about 2 mb of my ram. Public Sub Simulation3() strPathExcelFile_FILTER = ThisWorkbook.FullName Set objConnection = CreateObject("ADODB.Connection") Set objRecordSet = CreateObject("ADODB.Recordset") objConnection.Open = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & strPathExcelFile_FILTER & ";" & _ "Extended Properties=Excel 8.0;" objRecordSet.Open "SELECT COUNT(*) AS resultat FROM [SHEET1$A1:IV20] WHERE [PX_LAST] 20", objConnection, adOpenForwardOnly, adLockReadOnly Simulation.Label2.Caption = objRecordSet.fields("resultat") objRecordSet.Close objConnection.Close Set objConnection = Nothing Set objRecordSet = Nothing End Sub Thanks in advance. Regards, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Release Memory | Excel Discussion (Misc queries) | |||
Unable to release Excel COM object | Excel Programming | |||
how do i release memory | Excel Programming | |||
Type Statements and Memory Release | Excel Programming | |||
Release files from memory?? | Excel Programming |