Alright, this thing is going to make me crazy. I am using Visual Studio .NET 2003 and Office 2000 to create an online accounting web application for use within our intranet. One of the requirements of this project is to facilitate Excel-based data entry for numerical entry (to keep the old people from getting afraid when something looks different).

I am creating an instance of Excel, writing to the worksheets, adding a macro, then sending it over the browser to the client. Everything is hunky-dory and works great with the exception of releasing the Excel object. I can't get the thing to clear from memory. Here is a code snippet to give you an idea of what is going on:

'Create excel objects
Dim oXL As Excel.Application
Dim oBook As Excel._Workbook
Dim oSheet As Excel._Worksheet
Dim oMacro As VBIDE.VBComponent

'Create empty value
Dim oMissing As Object = System.Reflection.Missing.Value

'Clean up objects
GC.Collect()
oXL = New Excel.Application

'Suppress confirmation dialogs
oXL.DisplayAlerts = False

'Create new workbook
oBook = oXL.Workbooks.Add()

...... Perform stuff ......

'Cleanup

If Not oBook Is Nothing Then
oBook.Close(False, oMissing, oMissing)
End If
If Not oSheet Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oSheet)
oSheet = Nothing
End If
If Not oBook Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oBook)
oBook = Nothing
End If
If Not oMacro Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oMacro)
oMacro = Nothing
End If
If Not oXL Is Nothing Then
oXL.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oXL)
oXL = Nothing
End If

GC.Collect()

I think that I was pretty complete in cleaning up, so I tried updating Office with the available service packs and security updates. None of that worked. Does anyone have any ideas or some kind of potential workaround?

Thanks for any help that you can give me!