I've tried your resolution and other posts offering diiferent resolutions
unfortunately the EXCEL process remains present in Task Manager.
I've attached my code in hopes that it may shed some light on the issue.
As you can see the code is quite simple.....
My code is shown below:
Dim xlapp As Excel.Applicati on
xlapp = CType(CreateObj ect("Excel.Appl ication"), Excel.Applicati on)
Dim wb As Excel.Workbook = xlapp.Workbooks .Open(fileName)
Dim xlSheet As Excel.Worksheet
Dim currRow As Integer
xlSheet = wb.Worksheets(1 )
currRow = PTLRecordNumber
xlSheet.Cells(c urrRow, 1) = Me.LotNumber
xlSheet.Cells(c urrRow, 2) = Me.ScrewMachine Number
xlSheet.Cells(c urrRow, 3) = Me.PartNumber
xlSheet.Cells(c urrRow, 4) = Me.PlatingDate
xlSheet.Cells(c urrRow, 5) = 0
xlSheet.Cells(c urrRow, 6) = Me.LoadSize
xlSheet.Cells(c urrRow, 7) = Me.FullLoad
xlSheet.Cells(c urrRow, 8) = Me.Mean
xlSheet.Cells(c urrRow, 9) = Me.Hi
xlSheet.Cells(c urrRow, 10) = Me.Low
xlSheet.Cells(c urrRow, 11) = Me.PLTankNumber
xlSheet.Cells(c urrRow, 12) = Me.BasketNumber
xlSheet.Cells(c urrRow, 13) = Me.CarrierNumbe r
xlSheet.Cells(c urrRow, 14) = Me.AdhesionTest
xlSheet.Cells(c urrRow, 15) = Me.Solderabilit yTest
xlSheet.Cells(c urrRow, 16) = Me.OscilineNiTa nk
xlSheet.Cells(c urrRow, 17) = Me.Comments
'ss wb.SaveAs(fileN ame, Excel.XlFileFor mat.xlExcel9795 )
wb.Save()
wb.Close()
xlapp.Quit()
'ss xlApp.UserContr ol = True
'ss xlApp.Visible = True
'Attempt to close excel - notorious problem with .net not closing
all instances of Excel in task manager!!
System.Runtime. InteropServices .Marshal.Releas eComObject(xlSh eet)
System.Runtime. InteropServices .Marshal.Releas eComObject(wb)
System.Runtime. InteropServices .Marshal.Releas eComObject(xlap p)
xlapp = Nothing
wb = Nothing
xlSheet = Nothing
GC.Collect()
GC.WaitForPendi ngFinalizers()
GC.Collect()
GC.WaitForPendi ngFinalizers()
GC.Collect()
--
Thank You
"Herfried K. Wagner [MVP]" wrote:
"SteveS" <St****@discuss ions.microsoft. com> schrieb: I used the following but it still leaves a Excel process open in Task
Manager.
Make sure you are releasing the objects in the order they were created. In
addition you may want to post relevant parts of the code to enable people
here to determine whether or not you are really releasing all objects.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>