PivotTables interop reference causes crash in Excel 2000

C

Caitlin

The following VB.NET code (even extracted from other actions and
stripped of error handling) opens the pivot table correctly, but when I
attempt to close Excel, I get an application error from EXCEL.EXE (The
instruction at "0x300341b6" referenced memory at "0x650418f0". The
memory could not be "read".) and the EXCEL.EXE process continues to
run.

Opening the report in question directly in Excel does not cause errors
when Excel is closed.

The only occurs in Excel 2000; in Excel XP, I get no errors.

Dim oApp As Interop.Excel.ApplicationClass
Dim oWorkBook As Interop.Excel.Workbook
Dim oWorkSheet As Interop.Excel.Worksheet
Dim oPivotTable As Interop.Excel.PivotTable

oApp = New Excel.ApplicationClass
oWorkBook = objApp.Workbooks.Open(strExcelFile)
oWorkSheet = oWorkBook.ActiveSheet()
oPivotTable = oWorkSheet.PivotTables(1)
oPivotTable.PivotCache.LocalConnection = "OLEDB;Provider=MSOLAP;Data
Source=" + strCubeFile
oPivotTable.PivotCache.UseLocalConnection = True
oApp.Visible = True
oPivotTable = Nothing
oWorkSheet = Nothing
oWorkBook = Nothing
oApp = Nothing
GC.Collect()

(I know that forcing the garbage collection is bad; I've been trying
everything I could think of to release the COM objects, and the pivot
table just won't let go.)

Does anyone know what's happening here?

Thanks,
Caitlin Shaw
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top