![]() |
VBAProject unclosed even excel file was closed
I need to use some worksheets in the current workbook as datasources and run some queries.
The code to connect the workbook is just like below Set dbs = OpenDatabase(ThisWorkbook.Path & "\" & ThisWorkbook.Name, dbDriverCompleteRequired, True, _ "Excel 8.0;") strSQL = "SELECT .... " Set rs = dbs.OpenRecordset(strSQL) But I found that the VBAProject keep unclosed even the excel file was closed after running queries. Also, the performance seems dropped after running queries serveral times. Anyone know why ? Any problem with my code ? |
VBAProject unclosed even excel file was closed
Hi Steven,
You don't need the VBE to be open when you run your macros. Close each module then close the VBE. You might also consider putting subroutines together that are used together, and don't make the modules real large because it will take longer to find and run your macro (least that is my impression). --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "steven" wrote in message ... I need to use some worksheets in the current workbook as datasources and run some queries. The code to connect the workbook is just like below Set dbs = OpenDatabase(ThisWorkbook.Path & "\" & ThisWorkbook.Name, dbDriverCompleteRequired, True, _ "Excel 8.0;") strSQL = "SELECT .... " Set rs = dbs.OpenRecordset(strSQL) But I found that the VBAProject keep unclosed even the excel file was closed after running queries. Also, the performance seems dropped after running queries serveral times. Anyone know why ? Any problem with my code ? |
All times are GMT +1. The time now is 07:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com