Exception from HRESULT : 08x800A03EC

B

Bryson

Hi,
I'm using Microsoft Excel 11.0 Object Library and repeatedly getting the
error listed in the title. I have gotten excel exports to work with other
(less complex) projects in the past using the 11.0 library. I don't know
what to do about the problem. My goal is to export to excel a selected list
of tables, with each table occupying a seperate tab in excel. I hope someone
can help. Code below.

private void excel_write(int [] TableList)
{
statusBar1.Text="Writing to Excel";
statusBar1.Show();
ApplicationClass excel = new ApplicationClass();
excel.Application.Workbooks.Add(true);
Worksheet wk;
int columnIndex=0;
int rowIndex=0;
try
{
for (int i=0;i<TableList.Length;i++)
{
int j = TableList;
wk = new WorksheetClass();
columnIndex=0;
rowIndex=0;
foreach (DataColumn dc in dataSet1.Tables[j].Columns)
{
columnIndex++;
excel.Cells[1,columnIndex]=dc.ColumnName;
}
foreach (DataRow dr in dataSet1.Tables[j].Rows)
{
rowIndex++;
for
(columnIndex=0;columnIndex<dataSet1.Tables[j].Columns.Count;columnIndex++)
{
excel.Cells[rowIndex+1,columnIndex]=dr.ItemArray.GetValue(columnIndex);
}
}
excel.Application.Workbooks.Add(wk);
GC.Collect();
}
excel.Visible=true;
Worksheet worksheet = (Worksheet)excel.ActiveSheet;
worksheet.Activate();
}
catch (Exception ex)
{MessageBox.Show(ex.Message);}
 
C

Cindy M.

Hi =?Utf-8?B?QnJ5c29u?=,
I'm using Microsoft Excel 11.0 Object Library and repeatedly getting the
error listed in the title. I have gotten excel exports to work with other
(less complex) projects in the past using the 11.0 library. I don't know
what to do about the problem. My goal is to export to excel a selected list
of tables, with each table occupying a seperate tab in excel. I hope someone
can help.
The error is pretty generic, and can crop up under all kinds of circumstances.
Without knowing which line generates the error, it's impossible to even begin to
guess. Either put a breakpoint in your code so you can "walk" it to find out
where the error occurs, or take out the try-catch so that the error will break
to the offending line.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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