I have some trouble creating a Excel workbook. I get lots
of Exceptions.
For example I get
System.Runtime.InteropServices.COMException (0x80028018):
Old format or invalid type library.
at Excel.ApplicationClass.set_DisplayAlerts(Boolean RHS)
when I do
Excel.Application excel=new Excel.Application();
excel.DisplayAlerts=false; // <-- Exception thrown here.
I have problems with this as well (I get some HRESULT
error):
Excel.Range range;
range=worksheet.get_Range("A1",Missing.Value).get_ Resize
(1,fieldCount);
range.set_Value(Missing.Value,headers);
range.Font.Bold=true;
I also get the "Old format or invalid type library."
error when I do:
workbook.SaveAs
(@"C:\Book1.xls",Excel.XlFileFormat.xlXMLSpreadshe et,Missi
ng.Value,Missing.Value,Missing.Value,Missing.Value ,Excel.X
lSaveAsAccessMode.xlNoChange,Missing.Value,Missing .Value,M
issing.Value,Missing.Value,Missing.Value);
What is wrong? I'm using Office 2003 and I have the
following references:
adodb
Excel
Microsoft.Office.Core
stdole
System
VBIDE
usings:
using System;
using System.Collections;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.InteropServices;
using ADODB;
Other Excel things like
range.CopyFromRecordset(rs,Missing.Value,Missing.V alue);
Please help!
Walter