How should I be closing an excel file that I have just read in VBA? It is leaving an excel.exe process in the tasks after completing.
Sub SelectWorksheet() Dim oExcel As New Excel.Application Dim oWorkbook As Excel.Workbook Dim oWorksheet As Excel.Worksheet Dim i As Integer ActiveWorkspace.AddConfigurationVariable "TEMP_SHEET", 0 Set oWorkbook = oExcel.Workbooks.Open(KeyinArguments) WS_Count = oWorkbook.Sheets.Count SelectWorksheetForm.ListBox1.Clear For i = 1 To WS_Count Set oWorksheet = ActiveWorkbook.Worksheets(i) SelectWorksheetForm.ListBox1.AddItem oWorksheet.Name Next i SelectWorksheetForm_Initialize Set oExcel = Nothing End Sub
Unknown said:How should I be closing an Excel file that I have just read in VBA?
A better place to look for an answer to that question might be a site that deals with Microsoft VBA, Microsoft Excel or, more generally, Microsoft Office programming.
I'm sure that there are plenty of people who want to use one Office product from another Office product's VBA. Your question has probably been asked and answered multiple times. One or two VBA sites are listed here; there are plenty more, including specialist Excel sites.
Regards, Jon Summers LA Solutions
Please review the Communities guidelines when posting content on this site. Failure to follow these guidelines will result in immediate censure.
Thank you for your cooperation.