I would appreciate if you could help my on the below issue.
When i used an Excel object in my code, when closing this, the excel.xls applicataion remains opened at the task manager.
i am copying below the test code for your reference, which i am using in order to reproduce the same so any help
would really appreciated.
Also i noticed the below: When i comment out the following
the excel.exe instance is closing propertly. But when i am including this again in the project, in order to be able to save the excel, again the excel.exe remains in the task manager even if i closed the object.
----------##### Used Code ###### Private Sub Command1_Click() Dim ex As Excel.Application Dim exWB As Excel.Workbook 'Dim exSheet As Excel.Worksheet Set ex = CreateObject("Excel.Application") Set exWB = ex.Workbooks.Add exWB.Sheets(1).Range("a1").Value = "TEST" 'Set exSheet = exWB.ActiveSheet 'exSheet.Cells(1, 1).Value = "TEST" 'ex.ActiveWorkbook.SaveAs "C:\temp\temp.xls" exWB.SaveAs "C:\temp\temp.xls" 'Set exWB = ex.Workbooks.Open("C:\temp\temp.xls") Set exWB = ex.Workbooks.Add("C:\temp\temp.xls") ex.Visible = True 'ex.Workbooks.Application.SaveWorkspace "C:\temp\temp.xls" 'exWB.SaveAs "C:\temp\temp.xls" ex.UserControl = True exWB.Close ex.Workbooks.Close ex.DisplayAlerts = False ex.Application.Quit Set exWB = Nothing Set ex = Nothing End Sub ----------##### Used Code ######
Edited 3 Years Ago by Dani: Formatting fixed