Excel的错误HRESULT:0x800A03EC尝试获取范围与细胞的名字 [英] Excel error HRESULT: 0x800A03EC while trying to get range with cell's name

查看:379
本文介绍了Excel的错误HRESULT:0x800A03EC尝试获取范围与细胞的名字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与窗口服务项目。具有将数据写入到片材在Excel文件中的序列次。

但有时候,只是有时候,服务抛出异常从HRESULT异常:0x800A03EC,而它的试图获得一系列与细胞的名字

我已经把开放的code Excel工作表,并在这里获得的细胞。


  • OS:窗口服务器2003办事处:

  • Microsoft Office 2003的SP2

1:打开Excel工作表

  m_WorkBook = m_WorkBooks.Open(this.FilePath,0,假的,5,
     ,,真实,Excels.XlPlatform.xlWindows,;,
     真,假0,真实,0,0);

2:获取单元写入

 受保护对象m_MissingValue = System.Reflection.Missing.Value;
范围范围= m_WorkSheet.get_Range(cell.CellName,m_MissingValue);
//错误从此方法和单元名称是字符串。


解决方案

错误code 0x800A03EC (或-2146827284)指NAME_NOT_FOUND;换句话说,你问什么,和Excel无法找到它。

这是一个通用的code,它可以适用于很多事情不能找到如使用的是不是在那个时候像 PivotItem.SourceNameStandard 有效属性抛出这个时候PivotItem没有应用过滤器。 工作表[BLAHBLAH] 抛出这个,当表不存在等。一般情况下,你所要求的东西具有特定名称,它不存在。至于为什么,那将采取一些挖你的一部分。

检查表肯定确实有你所要求的范围,或者说, .CellName 绝对是回馈你所要求的范围的名称。

I am working with Window Service project. that have to write data to a sheet in Excel file in a sequence times.

But sometimes, just sometimes, the service throw out the exception "Exception from HRESULT: 0x800A03EC" while it's trying to get range with cell's name.

I have put the code of opening excel sheet, and getting cell here.

  • OS: window server 2003 Office:
  • Microsoft Office 2003 sp2

1: Opening excel sheet

m_WorkBook = m_WorkBooks.Open(this.FilePath, 0, false, 5,
     "", "", true, Excels.XlPlatform.xlWindows, ";",
     true, false, 0, true, 0, 0);

2: Getting cell to write

protected object m_MissingValue = System.Reflection.Missing.Value;
Range range = m_WorkSheet.get_Range(cell.CellName, m_MissingValue);
// error from this method, and cell name is string.

解决方案

The error code 0x800A03EC (or -2146827284) means NAME_NOT_FOUND; in other words, you've asked for something, and Excel can't find it.

This is a generic code, which can apply to lots of things it can't find e.g. using properties which aren't valid at that time like PivotItem.SourceNameStandard throws this when a PivotItem doesn't have a filter applied. Worksheets["BLAHBLAH"] throws this, when the sheet doesn't exist etc. In general, you are asking for something with a specific name and it doesn't exist. As for why, that will taking some digging on your part.

Check your sheet definitely does have the Range you are asking for, or that the .CellName is definitely giving back the name of the range you are asking for.

这篇关于Excel的错误HRESULT:0x800A03EC尝试获取范围与细胞的名字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆