excel error after exported

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi,
below is my excel
Public Class mmenu
Dim xl As New Excel.Application
Dim xlb As Excel.Workbook = xl.Workbooks.Add()
Dim xls As Excel.Worksheet = xlb.ActiveSheet

button export event
add my data here
xls.SaveAs(filename)
xl.Quit()
GC.Collect()

end class
when i click export for the first time. excel successfully export the data as expected.
but if i click again without closing my application and without opening the exported file . vb give me this error
" COMException was unhandled"
Exception from HRESULT: 0x800A03EC
everytime i want to export for the second time, i have to close the application and run again.
same error also happened when i open my exported excel file and try to export for the first time.
and i notice my task manager there under processes tab
each time i run excel once. the EXCEL.EXE *32 will increase by one. i have to slowly close one by one. why is this so? is there a way to kill the excel.exe after exported?

View the full article
 
Back
Top