Excel HRESULT: 0x800A03EC when using Workbooks.open or Workbooks._opentext in C# 
Author Message
 Excel HRESULT: 0x800A03EC when using Workbooks.open or Workbooks._opentext in C#

Hello all,

Any help on the following would be greatly appreciated - it's a time
critical event for me at this point.

I'm importing a comma delimited text file into Excel v9 (2000) using the
following C# code. setting comma delimited to true.

excelwrap.Application oApp = new excelwrap.Application();

oApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);

Workbooks oWrkBooks = oApp.Workbooks;

oWrkBooks._OpenText(sFilePath + "\\" + sTextFileName, null, null,

XlTextParsingType.xlDelimited, XlTextQualifier.xlTextQualifierNone, null,
null, null, true , null, null, null, null, null);

On either open or _opentext I'm getting the error: 0x800A03EC - the
following is the logged error:

<error time="9:58:45" type="system">
<errortext>
<![CDATA[ Exception from HRESULT: 0x800A03EC.]]>
</errortext>
<source>
<![CDATA[excelwrap]]>
</source>
<stacktrace>
<![CDATA[    at excelwrap.Workbooks._OpenText(String Filename, Object
Origin, Object StartRow, Object DataType, XlTextQualifier TextQualifier,
Object ConsecutiveDelimiter, Object Tab, Object Semicolon, Object Comma,
Object Space, Object Other, Object OtherChar, Object FieldInfo, Object
TextVisualLayout)

   at eOmComReport.ComReport.CreateExcelSheetVSA(DataSet ReportData, String
ReportName) in c:\documents and
settings\administrator\vswebcache\kcyrcomp\deveom\classes\comreport.cs:line
349]]>
</stacktrace>
</error>

I'm able to open, add to and save a workbook and worksheet when adding
information by cell or range, but no love on opening a comman delimitted
text file.

Kris



Wed, 26 May 2004 23:08:17 GMT  
 Excel HRESULT: 0x800A03EC when using Workbooks.open or Workbooks._opentext in C#

Quote:
> Hello all,

> Any help on the following would be greatly appreciated - it's a time
> critical event for me at this point.

What happens if, instead of passing null, you pass
System.Reflection.Missing.Value?

Peter

--

Waiting for the Vengabus? http://www.microsoft.com/info/cpyright.htm
Please post all questions to the group. Thanks.



Thu, 27 May 2004 04:02:44 GMT  
 Excel HRESULT: 0x800A03EC when using Workbooks.open or Workbooks._opentext in C#
Peter,

Thanks for the response.

I recoded to the following on your suggestion:
oWrkBooks._OpenText(sFilePath + "\\" + sTextFileName,
System.Reflection.Missing.Value, System.Reflection.Missing.Value,

XlTextParsingType.xlDelimited, XlTextQualifier.xlTextQualifierNone,
System.Reflection.Missing.Value,

System.Reflection.Missing.Value, System.Reflection.Missing.Value, true ,
System.Reflection.Missing.Value,

System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value,

System.Reflection.Missing.Value);

I received the same exception.  I am successfully able to save with the
below code, so it seems that "null" is potentially legit:
oWrkBook.SaveAs(sWorkbookFile, XlFileFormat.xlWorkbookNormal,

null, null, null, null, XlSaveAsAccessMode.xlExclusive, null, null, null,
null);

Any further advice would be much appreciated.

Thanks again.

Kris


Quote:


> > Hello all,

> > Any help on the following would be greatly appreciated - it's a time
> > critical event for me at this point.

> What happens if, instead of passing null, you pass
> System.Reflection.Missing.Value?

> Peter

> --

> Waiting for the Vengabus? http://www.microsoft.com/info/cpyright.htm
> Please post all questions to the group. Thanks.



Thu, 27 May 2004 04:35:08 GMT  
 Excel HRESULT: 0x800A03EC when using Workbooks.open or Workbooks._opentext in C#

Quote:
> I received the same exception.  I am successfully able to save with the
> below code, so it seems that "null" is potentially legit:

Do you pass the full path to the file? If you are only passing the file
name, expecting it to be relative to the current directory, it won't work.

Peter

--

Waiting for the Vengabus? http://www.microsoft.com/info/cpyright.htm
Please post all questions to the group. Thanks.



Fri, 28 May 2004 05:27:53 GMT  
 Excel HRESULT: 0x800A03EC when using Workbooks.open or Workbooks._opentext in C#
Yes, I pass the full file name in "c:\directory\blah\file.txt" format.  I
also simplified so that it's the default tab delimited format, but to no
avail.

Would you have a working line of wkb._OpenText or wkb.Open that is
functioning for you?  I must be missing something here.

Thanks.

Kris



Quote:


> > I received the same exception.  I am successfully able to save with the
> > below code, so it seems that "null" is potentially legit:

> Do you pass the full path to the file? If you are only passing the file
> name, expecting it to be relative to the current directory, it won't work.

> Peter

> --

> Waiting for the Vengabus? http://www.microsoft.com/info/cpyright.htm
> Please post all questions to the group. Thanks.



Fri, 28 May 2004 23:53:22 GMT  
 Excel HRESULT: 0x800A03EC when using Workbooks.open or Workbooks._opentext in C#
Peter,

Tried this as a final shot and it seems to work.  Thanks for your help.

Still inconsistent that wkb.SaveAs works so differently than wkb.Open

oWrkBooks.Open(sTextFileName, System.Reflection.Missing.Value,
System.Reflection.Missing.Value,

System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value,

System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value,

System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value,

System.Reflection.Missing.Value);

Thanks Again.

Kris


Quote:


> > I received the same exception.  I am successfully able to save with the
> > below code, so it seems that "null" is potentially legit:

> Do you pass the full path to the file? If you are only passing the file
> name, expecting it to be relative to the current directory, it won't work.

> Peter

> --

> Waiting for the Vengabus? http://www.microsoft.com/info/cpyright.htm
> Please post all questions to the group. Thanks.



Sat, 29 May 2004 00:20:31 GMT  
 Excel HRESULT: 0x800A03EC when using Workbooks.open or Workbooks._opentext in C#

Quote:
> Peter,

> Tried this as a final shot and it seems to work.  Thanks for your help.

> Still inconsistent that wkb.SaveAs works so differently than wkb.Open

In the metadata, all the parameters are marked as "optional", but I guess
Excel treats some of them specially.

My guess would be that passing null for the 'TextQualifier' parameter is
what got you into trouble -- it's an enum, not an object, and 0 is not a
valid value. In the case of SaveAs, there is also an enum value, but it
probably has a fall-through case for the enum parameter which let it "work"
(ie, silently fail) for you.

Peter

--

Waiting for the Vengabus? http://www.microsoft.com/info/cpyright.htm
Please post all questions to the group. Thanks.



Sat, 29 May 2004 03:30:40 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Excel 97/2000: making custom functions (in a hidden workbook) available to all open workbooks

2. How can I open Excel workbook without using Excel.Worksheet

3. VBA: Excel workbook to workbook transfer

4. combine multiple excel workbooks into one workbook

5. ASP using a VB DLL to open an Excel workbook

6. Open Excel workbook using ADO

7. Excel Workbook takes too long to open in Excel 2000

8. Finding open Excel workbooks from Access.

9. Open Excel workbook

10. read/write without open workbooks in excel

11. Opening a Excel Workbook

12. Error handling when opening a workbook (Excel)

 

 
Powered by phpBB® Forum Software