使用IDisposable清理ExcelInterop对象
Public Sub Dispose() Implements IDisposable.Dispose If Not bolDisposed Then Finalize() System.GC.SuppressFinalize(Me) End IfEnd SubProtected Overrides Sub Finalize() _xlApp = Nothing bolDisposed = True MyBase.Finalize()End Sub
_xlApp
Try _xlApp = CType(GetObject(, "Excel.Application"), Excel.Application)Catch e As Exception _xlApp = CType(CreateObject("Excel.Application"), Excel.Application) End Try
using-statement
德玛西亚99