I'm trying to write some data from my windowsform into a Excel
file, this works.
' Excel load data
Dim oExcelApp As New Microsoft.Office.Interop.Excel.Application
Dim oWorkBook As Microsoft.Office.Interop.Excel.Workbook
Dim oWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
oWorkBook = oExcelApp.Workbooks.Open("C:\Temp\Test.xlsx")
oWorkSheet = oWorkBook.Worksheets(1)
oWorkSheet.Range("A1").Value = "Test"
oWorkBook.Save()
oWorkBook.Close()
Problem is: When I am done Excel
is still running in my task manager. When I press the button like 10 times there are 10 Excel
references in my task manager.
Question: How can I fully unload Excel
after writing the value into the Excel
?