R
Rick
VS 2005
Office 2000
using late bound Excel automation object.
Seems like this is a common problem, which is normally related to the
automation object creating something that is hidden from me so I don't
release it and therefore the automation object will not free itself.
Is there some way to discover what is left over after I have tried to free
this object?
From the task manager I can see that Excel is still running at the end of
the procedure. If I close the program, Excel is then freed. A "quirk" when
I run with Office 2000 installed is that if I try to open the file the
automation object created, Excel opens and never shows the document. If I
close this excel window, the Excel in memory is also closed and then I can
properly open the file. When I run in Office 2007, the file opens properly
the first time.
Any suggestions?
Rick
I'm doing something like this:
Dim xlApp As Object 'Excel app
Dim xlWbs As Object 'workbooks
Dim xlWb As Object 'workbook
Dim xlWss As Object 'worksheets
Dim xlWs As Object 'worksheet
Dim xlRange As Object 'Range object
Dim fc As Object 'formatcondition object
try
'create all the items and write to a new spreadsheet
finally
GC.Collect()
GC.WaitForPendingFinalizers()
'go through each of the objects defined above and call each one to free them
If Not obj Is Nothing Then
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj)
obj = Nothing
End If
GC.Collect()
GC.WaitForPendingFinalizers()
end
Office 2000
using late bound Excel automation object.
Seems like this is a common problem, which is normally related to the
automation object creating something that is hidden from me so I don't
release it and therefore the automation object will not free itself.
Is there some way to discover what is left over after I have tried to free
this object?
From the task manager I can see that Excel is still running at the end of
the procedure. If I close the program, Excel is then freed. A "quirk" when
I run with Office 2000 installed is that if I try to open the file the
automation object created, Excel opens and never shows the document. If I
close this excel window, the Excel in memory is also closed and then I can
properly open the file. When I run in Office 2007, the file opens properly
the first time.
Any suggestions?
Rick
I'm doing something like this:
Dim xlApp As Object 'Excel app
Dim xlWbs As Object 'workbooks
Dim xlWb As Object 'workbook
Dim xlWss As Object 'worksheets
Dim xlWs As Object 'worksheet
Dim xlRange As Object 'Range object
Dim fc As Object 'formatcondition object
try
'create all the items and write to a new spreadsheet
finally
GC.Collect()
GC.WaitForPendingFinalizers()
'go through each of the objects defined above and call each one to free them
If Not obj Is Nothing Then
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj)
obj = Nothing
End If
GC.Collect()
GC.WaitForPendingFinalizers()
end