LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default exception 0x800A03EC in excel

Hello

I need to save excel file, but the method saveas result in exception
HRESULT: 0x800A03EC
In System.Exception {System.Runtime.InteropServices.COMException}

I use this C# code:

/* ----------------- BEGIN CODE ----------------- */
using System;
using System.Collections.Generic;
using System.Text;
using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;
using System.Diagnostics;


namespace console

{

class Program

{
static Excel.Application xlApp;
static Excel.Workbook xlBook;
static Excel.Worksheet xlSheet1, xlSheet2, xlSheet3;
static Excel.AppEvents_WorkbookBeforeCloseEventHandler
EventDel_BeforeBookClose;
static Excel.DocEvents_ChangeEventHandler EventDel_CellsChange;
//InitializeComponent();
static void Main(string[] args)
{
try

{

//Start Excel, and then create a new workbook.
xlApp = new Excel.Application();
xlBook = xlApp.Workbooks.Add(Missing.Value);
xlBook.Windows.get_Item(1).Caption = "XL Event Test";
xlSheet1 = (Excel.Worksheet)xlBook.Worksheets.get_Item(1);
xlSheet2 = (Excel.Worksheet)xlBook.Worksheets.get_Item(2);
xlSheet3 = (Excel.Worksheet)xlBook.Worksheets.get_Item(3);
xlApp.Visible = false;
xlApp.UserControl = false;
xlSheet1.Activate();
xlSheet1.Cells[1, 2] = "tESTE";
xlApp.ActiveCell.FormulaR1C1 = "10";
xlApp.ActiveWorkbook.SaveAs("c:\teste.xls", "xls", "", "",
null, null, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode. xlNoChange,
null, null, null, null, null);

}

catch (Exception ex)

{

throw ex;

}

}

private void CellsChange(Excel.Range Target)

{

//This is called when any cell on a worksheet is changed.
Debug.WriteLine("Delegate: You Changed Cells " +
Target.get_Address(Missing.Value, Missing.Value,
Excel.XlReferenceStyle.xlA1, Missing.Value, Missing.Value) +
" on " + Target.Worksheet.Name);
}


private void BeforeBookClose(Excel.Workbook Wb, ref bool Cancel)
{
//This is called when you choose to close the workbook in Excel.
//The event handlers are removed, and then the workbook is closed
//without saving the changes.
Wb.Saved = true;
Debug.WriteLine("Delegate: Closing the workbook and removing
event handlers.");
xlSheet1.Change -= EventDel_CellsChange;
xlSheet2.Change -= EventDel_CellsChange;
xlSheet3.Change -= EventDel_CellsChange;
xlApp.WorkbookBeforeClose -= EventDel_BeforeBookClose;
}

}
}
/* ----------------- END CODE ----------------- */
Thanks in advance

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception from HRESULT: 0x800A03EC Samir1014 Excel Programming 2 September 13th 07 07:14 PM
SaveCopyAs generating the 0x800a03ec exception PromisedOyster Excel Programming 0 December 27th 06 09:05 AM
Exception from HRESULT: 0x800A03EC nano2k New Users to Excel 0 July 21st 06 12:15 PM
Exception from HRESULT: 0x800A03EC. at Microsoft.Office.Interop.Excel.WorkbookClass.get_VBProject() [email protected] Excel Programming 0 April 11th 06 04:40 PM
Chart.Export throws COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC. Steven Excel Programming 1 November 5th 03 06:59 PM


All times are GMT +1. The time now is 06:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"