Kaup, Chester
Chester_Kaup at kindermorgan.com
Thu Jun 3 15:10:01 CDT 2010
I have the following module that opens Excel does some work and then closes Excel. Problem is that even though Excel closes the process is still running. What am I missing on killing the process. Thanks. Function GetTemperature() Dim xl As Object Set xl = CreateObject("Excel.Application") xl.WorkBooks.Open "C:\Files\Excel\NOAA Data.xls" xl.Visible = True xl.Sheets("Sheet1").Select xl.Range("A1").Select xl.ActiveCell.QueryTable.Refresh xl.Application.Run "Macro1" strSql = "DELETE * from [tbl Temperature];" DBEngine(0)(0).Execute strSql, dbFailOnError DoCmd.TransferSpreadsheet acImport, 8, "tbl Temperature", "c:\files\excel\NOAA Data.xls", True, "Sheet3!a1:b32767" xl.DisplayAlerts = False xl.Save xl.DisplayAlerts = True xl.Quit Set xlWorkBooks = Nothing Set xl = Nothing End Function Chester Kaup Engineering Technician Kinder Morgan CO2 Company, LLP Office (432) 688-3797 FAX (432) 688-3799 No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.