T
TADropik
I use the code below to create an Excel workbook and save it.
However, the OS doesn't let go of Excel. I still see EXCEL in the Task
Manager.
Dim objExcel As excel.Application
Dim objWorkbook As excel.Workbook
Dim objWorksheet As excel.Worksheet
Set objExcel = GetObject("", "excel.application")
objExcel.Visible = False
Set objWorkbook = objExcel.Workbooks.Add
objWorkbook.Worksheets.Add
Before:=objWorkbook.Worksheets(objWorkbook.Worksheets.Count)
objWorkbook.ActiveSheet.Name = "Data-Test"
Set objWorksheet = objWorkbook.Worksheets("Data-Test")
objWorksheet.Select
objExcel.ScreenUpdating = False
objWorksheet.Cells(1, 1) = "TESTING EXCEL"
objWorksheet.Cells(1, 1).ColumnWidth = 17
objWorksheet.Cells(1, 1).Font.Bold = True
objExcel.DisplayAlerts = False
objExcel.ActiveWorkbook.SaveAs ("C:\Excel\Test_Excel.xls")
objExcel.DisplayAlerts = True
objExcel.ScreenUpdating = True
objExcel.Quit
Set objWorksheet = Nothing
Set objWorkbook = Nothing
Set objExcel = Nothing
However, the OS doesn't let go of Excel. I still see EXCEL in the Task
Manager.
Dim objExcel As excel.Application
Dim objWorkbook As excel.Workbook
Dim objWorksheet As excel.Worksheet
Set objExcel = GetObject("", "excel.application")
objExcel.Visible = False
Set objWorkbook = objExcel.Workbooks.Add
objWorkbook.Worksheets.Add
Before:=objWorkbook.Worksheets(objWorkbook.Worksheets.Count)
objWorkbook.ActiveSheet.Name = "Data-Test"
Set objWorksheet = objWorkbook.Worksheets("Data-Test")
objWorksheet.Select
objExcel.ScreenUpdating = False
objWorksheet.Cells(1, 1) = "TESTING EXCEL"
objWorksheet.Cells(1, 1).ColumnWidth = 17
objWorksheet.Cells(1, 1).Font.Bold = True
objExcel.DisplayAlerts = False
objExcel.ActiveWorkbook.SaveAs ("C:\Excel\Test_Excel.xls")
objExcel.DisplayAlerts = True
objExcel.ScreenUpdating = True
objExcel.Quit
Set objWorksheet = Nothing
Set objWorkbook = Nothing
Set objExcel = Nothing