HRESULT:工作表上的 0x800A03EC。范围

发布于 2024-11-30 06:39:59 字数 294 浏览 0 评论 0原文

我在 Worksheet.range 方法上收到 HRESULT: 0x800A03EC。行数超过70K。 Office 2007。

代码:

Microsoft.Office.Interop.Excel.Range neededRange
    = currentWS.Range[cell.Cells[1, 1], cell.Cells[nRowCount, nColumnCount]];

这里我的行数超过 65530 。中断此功能。我观察到只有当行数超过 65530 时它才会中断。

I am getting HRESULT: 0x800A03EC on Worksheet.range method. Number of rows are more than 70K. Office 2007.

Code:

Microsoft.Office.Interop.Excel.Range neededRange
    = currentWS.Range[cell.Cells[1, 1], cell.Cells[nRowCount, nColumnCount]];

Here my rowcount is more than 65530 . Breaks on this function. I have observed that it breaks only when row count goes more than 65530.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(28

伴我心暖 2024-12-07 06:40:00

我通过使用下面的代码解决了这个问题。请不要在这些函数中使用其他参数。

mWorkBook = xlApp.Workbooks.Open(FilePath)

mWorkBook.Save();

已解决

I resolved this issue by using the code below. Please do not use other parameters in these functions.

mWorkBook = xlApp.Workbooks.Open(FilePath)

mWorkBook.Save();

RESOLVED

神魇的王 2024-12-07 06:40:00

看起来这是一个非常普遍的错误,表示您尝试的操作“出了问题”。我观察到,如果您有公式错误并将该公式分配到单元格中,也会发生这种情况。例如“=fubar()”

Seems like this i s a pretty generic error for "something went wrong" with the operation you attempted. I have observed that will also occur if you have a formula error and are assigning that formula into a cell. E.g. "=fubar()"

薔薇婲 2024-12-07 06:40:00

我已经多次遇到过这个问题,每次总是因为复制选项卡名称而出现一些错误,或者在当前情况下,它只是因为我在 get_Range 中出现拼写错误而发生。 我试图通过数字和数字而不是字母和数字来获取单元格。
让我抓狂的是,因为错误将我指向了几行,但我已经注释掉了“错误行”之上的其他工作表的所有创建以及该行及以下内容的创建没有任何问题。
碰巧扫描了上面的几行,发现我在 get_Range 语句中放入了 6 + lastword, C + lastrow ,当然你不能有一个以数字总是字母多于数字。

I've come across it several different times and every time it was always some error with either duplicating a tab name or in this current case it just occurred because I simply had a typo in the get_Range where I tried to get a Cell by number and number instead of the letter and number.
Drove me crazy because the error pointed me to a few lines down but I had commented out all of the creation of the other sheets above the "error line" and the ones in the line and below were created with no issue.
Happened to scan up a few lines above and saw that I put 6 + lastword, C + lastrow in my get_Range statement and of course you can't have a cell starting with a number it's always letter than number.

つ可否回来 2024-12-07 06:40:00

我遇到了同样的错误。对我来说,在尝试分别设置 CountIf 和 CountIfs 时,我收到了错误。

经过一番尝试后,我发现这是一个使用多个参数的所有公式都遇到的问题。

原来是参数分隔符“;” (分号),我在 excel 中使用的分号不适合我在代码隐藏中使用。如果我使用“,”(逗号)代替,则公式可以正确使用。
注:之后在Excel中查看时显示为“;” (分号)。

我的试验和错误过程包括尝试设置一堆不同的公式,这就是我最终得到的“修复”。
我运行的是英语 Windows,但我位于丹麦,我不知道我的问题是否涉及某种本地化。

CultureInfo.CurrentCulture.TextInfo.ListSeparator 是“;”,这可以正确分隔验证器规则值。
也许这就是我的参数分隔符是别的东西的原因。

无论如何;该公式可能是错误的,因为您需要使用不同的参数分隔符。

I ran in to the same error. For me it was while trying to set a CountIf and CountIfs respectively that I got the error.

After some trial an error I found out it was an issue I had with all formulas using multiple parameters.

It turns out that the parameter separator ";" (semicolon), which I use in excel is not the correct one for me to use in code behind. If I use "," (comma) in stead, the formula is correctly used.
Note: When viewed in Excel afterwards, it is shown as ";" (semicolon).

My trial and error process included trying to set a bunch of different formulas, and this was the 'fix' I ended up with.
I am running an English windows, but I am located in Denmark, I have no idea if there is some kind of localization involved with my issue.

CultureInfo.CurrentCulture.TextInfo.ListSeparator is ";", and this works correctly for separating validator rule values.
Perhaps this is the reason why my parameter separator is something else.

Anyways; the formula could be wrong because you need to use a different parameter separator character.

徒留西风 2024-12-07 06:40:00

我有同样的错误代码。事实证明这里的评论对我有帮助。计数不从 0 开始。注释掉的行引发此错误。

字符串单元格 = (string)range.Cells[3, 3].Value;
此行工作正常

string QuestionID = (string)range.Cells[1, 0].Value;此行抛出此错误

I had this same error code. Turns out a comment here helped me. Count does not start from 0. The commented out line was throwing this error.

string cell = (string)range.Cells[3, 3].Value;
This line worked fine

string QuestionID = (string)range.Cells[1, 0].Value;This line threw this error

看海 2024-12-07 06:40:00

我知道这很旧,但在尝试设置电子表格范围时遇到了相同的错误,如下所示:

rngSumFormula = mxlWorksheet.Range(strFormulaRange)

在此之前有很多 mxlWorksheet.Range 语句,但每次都失败。经过大量挖掘后发现,strFormulaRange 中的范围值与其他值之间的差异在于它在范围内有逗号,即“B2,C2,D2:E2”。在此语句之前,所有范围值都简单地带有一个冒号,即“D2:E2”。

那么为什么这是一个问题呢?因为我在 Windows 10 中不使用逗号作为默认分隔符,而是使用管道字符 (|),因为我处理大量 SQL 批量加载的描述字段,其中包含大量非分隔符的逗号。一旦我将默认分隔符更改回逗号,我的错误就消失了。

这可能不会帮助很多人,因为我认为分隔符的更改并不常见,但由于这是我想分享的解决方案。仅供参考,您可以在此处更改 Windows 10 中的分隔符:

“区域设置”>“其他日期、时间和时间”。区域设置 > 更改日期、时间或数字格式 > 其他设置,然后向下滚动到列表分隔符。

I know this is old but I had the same error when trying to set a spreadsheet range as follows:

rngSumFormula = mxlWorksheet.Range(strFormulaRange)

There were plenty of mxlWorksheet.Range statements before this one but it failed every time. It turned out, after a ton of digging that the difference between my range value in strFormulaRange and the other values is that it had commas in the range i.e. "B2,C2,D2:E2". Before this statement all the ranges values simple had a colon i.e. "D2:E2".

So why was this an issue? Because I don't use comma as my default separator in Windows 10 instead I use a pipe character (|) as I deal with a lot of SQL bulk loads of description fields which contain lots of commas that aren't separators. Once I changed my default separator back to a comma my error disappeared.

This probably won't help very many people as I don't think separator changes are very common but since it was my solution I wanted to share. Just for reference you change your separator in Windows 10 here:

Region Settings>Additional Date, Time & Regional Settings>Change Date, Time or Number Formats>Additional Settings and then scroll down to List separator.

若无相欠,怎会相见 2024-12-07 06:40:00

对我来说,当我尝试在 Excel 工作表中发布注释列时,答案就出现了。该表不接受它。我一直收到这个错误。我想这可能是某个角色或者什么。如果是的话,我不知道是什么。所以我只是将其截断为 250。我不知道实际的大小限制是多少?!...但就我在本报告中的目的而​​言,这并不重要:

那些空的我已经用“缺失”填充了。价值'。

            if (dr[c] != null && dr[c].ToString() != "")
            {
                string t = dr[c].ToString().Replace("\t", "").Replace("|", ":").Replace("/", "-").Replace("\n", " ").Trim();
                if (t.Length > 250)
                    t = t.Substring(0, 250);
                arr[r, c] = t;
            }

For me the answer came when trying to post a Notes column in the Excel sheet. The sheet would not accept it. I kept getting this error. I thought it might be a certain character or something. If it is, I don't know what. So I just cut it off at 250. I don't know what the size limit actually is?!... but for my purpose in this report it's not really important:

The ones that are empty I've already filled with 'Missing.Value'.

            if (dr[c] != null && dr[c].ToString() != "")
            {
                string t = dr[c].ToString().Replace("\t", "").Replace("|", ":").Replace("/", "-").Replace("\n", " ").Trim();
                if (t.Length > 250)
                    t = t.Substring(0, 250);
                arr[r, c] = t;
            }
几度春秋 2024-12-07 06:40:00

当 Excel 文件因某种原因损坏时也会发生此类错误

This type of error can also occur when the excel file is corrupted for some reason

短叹 2024-12-07 06:39:59

如果您使用向后兼容的工作表(.xls)而不是 .xlsx,则会出现此问题。

为了允许工作表在 pre Office 2007 版本中打开,它不能包含超过 65k 行。您可以使用 ctrl+arrowdown 直到到达底部来检查工作表中的行数。如果您尝试获取大于该行数的范围,则会产生错误

This problem occurs if you are using a backwards compatible sheet (a .xls) instead of a .xlsx

To allow sheets to be opened in pre office 2007 version it can't contain more than 65k rows. You can check the number of rows in your sheet by using ctrl+arrowdown till you hit the bottom. If you try to get a range larger than that number of rows it will create an error

请持续率性 2024-12-07 06:39:59

我们收到的也是一样的。例外的是

堆栈跟踪:位于 Microsoft.Office.Interop.Excel._Workbook.SaveAs(对象文件名、对象文件格式、对象密码、对象 WriteResPassword、对象
ReadOnlyRecommended、对象 CreateBackup、XlSaveAsAccessMode AccessMode、对象冲突解决方案、对象 AddToMru、对象 TextCodepage、对象文本
视觉布局,本地对象)`

但内部例外

HRESULT 异常:0x800A03EC 2012-11-01 10:37:59`

我们能够使用 这篇文章,其中为了方便起见,我在这里引用...

  1. 以管理员身份登录服务器。
  2. 转到“开始”-> “运行”并输入“taskmgr”
  3. 转到任务管理器中的进程选项卡并选中“显示所有进程”
    用户”
  4. 如果列表中有任何“Excel.exe”条目,请右键单击
    条目并选择“结束进程”
  5. 关闭任务管理器。
  6. 转到“开始”-> “运行”并输入“services.msc”
  7. 如果 Excel 自动化服务正在运行,请停止该服务。
  8. 转到“开始”-> “运行”并输入“dcomcnfg”
  9. 这将打开组件服务窗口,展开“控制台”
    Root” -> “计算机” -> “DCOM 配置”
  10. 在组件列表中找到“Microsoft Excel 应用程序”。
  11. 右键单击该条目并选择“属性”
  12. 转至属性对话框中的“身份”选项卡。
  13. 选择“交互式用户。”
  14. 单击“确定”按钮
  15. 切换到服务控制台
  16. 再次启动自动化 Excel
  17. 测试应用程序的服务。

We were receiving the same. The exception was

Stacktrace: at Microsoft.Office.Interop.Excel._Workbook.SaveAs(Object Filename, Object FileFormat, Object Password, Object WriteResPassword, Object
ReadOnlyRecommended, Object CreateBackup, XlSaveAsAccessMode AccessMode, Object ConflictResolution, Object AddToMru, Object TextCodepage, Object Text
VisualLayout, Object Local)`

with an inner exception of

Exception from HRESULT: 0x800A03EC 2012-11-01 10:37:59`

We were able to resolve the problem with information from this post, which I quote here for convenience...

  1. Login to the server as a administrator.
  2. Go to "Start" -> "Run" and enter "taskmgr"
  3. Go to the process tab in task manager and check "Show Processes from all
    users"
  4. If there are any "Excel.exe" entries on the list, right click on the
    entry and select "End Process"
  5. Close task manager.
  6. Go to "Start" -> "Run" and enter "services.msc"
  7. Stop the service automating Excel if it is running.
  8. Go to "Start" -> "Run" and enter "dcomcnfg"
  9. This will bring up the component services window, expand out "Console
    Root" -> "Computers" -> "DCOM Config"
  10. Find "Microsoft Excel Application" in the list of components.
  11. Right click on the entry and select "Properties"
  12. Go to the "Identity" tab on the properties dialog.
  13. Select "The interactive user."
  14. Click the "OK" button.
  15. Switch to the services console
  16. Start the service automating Excel
  17. Test you application again.
浅黛梨妆こ 2024-12-07 06:39:59

我遇到了这个问题。

发现在我的代码中的某个地方我要求它从 0 开始计数(就像在 C# 代码中一样)。

结果 Excel 计数从 1 开始。

I encountered this issue.

Discovered that somewhere in my code I was asking it to count starting from 0 (as you would in a C# code).

Turns out Excel counting starts at 1.

夕嗳→ 2024-12-07 06:39:59

看看上面的各种响应,并借鉴我自己最近的经验(我得到这个错误代码做了一些完全不相关的事情 - 设置 Application.Calculation),我得出结论,相同的错误代码用于指示多个不相关的问题。所以@Garreh你可能应该问一个新问题(并不是任何人都能够仅根据错误代码提供帮助)。我在 C# 中的 Word 互操作中看到了同样的情况,其中相同的 HRESULT 似乎可用于几乎所有类型的错误。我从未找到任何令人满意的 Microsoft 文档来说明这些代码的含义。

Looking at the various responses above, and drawing on my own recent experience (I got this error code doing something completely unrelated -- setting Application.Calculation) I conclude that the same error code is used to indicate multiple unrelated problems. So @Garreh you should probably be asking a new question (not that anyone will be able to help based on the error code alone). I've seen the same thing working with Word interop from C#, where the same HRESULT seems to be used for almost every kind of error. I've never found any satisfactory Microsoft documentation on what the codes might mean.

听不够的曲调 2024-12-07 06:39:59

如果要保存的分区上没有空间,也可能会导致这种情况。

我检查了我的高清,发现它已满。将一些不需要的文件移动到不同的分区解决了我的问题。

This could also be caused if you have no room on the partition you are saving to.

I checked my HD and foind it was maxed. Moving some un-needed files to a different partition resolved my problem.

み青杉依旧 2024-12-07 06:39:59

简单来说,Excel 文件已损坏。
最好的解决方案是更改/修复文件。(复制现有文件并重命名)

Simply, the excel file is corrupt.
Best solution is change/repair the file.(make a copy of the existing file and rename it)

饭团 2024-12-07 06:39:59

编辑:这好多了!
抱歉,您不需要那个旧功能。只需执行以下操作:

Microsoft.Office.Interop.Excel.Range neededRange = currentWS.Range["A1", ((Microsoft.Office.Interop.Excel.Range)currentWS.Cells[nRowCount, nColumnCount])];

这应该会像魅力一样发挥作用。为了便于将来参考,请将您正在使用的相关代码放在您的问题中。不要让人们在评论中询问。我想这就是你被否决的原因。

EDIT: THIS IS WAY BETTER!!!
You don't need that old function, sorry. Just do as follows:

Microsoft.Office.Interop.Excel.Range neededRange = currentWS.Range["A1", ((Microsoft.Office.Interop.Excel.Range)currentWS.Cells[nRowCount, nColumnCount])];

That should work like a charm. And for future reference, put the relevant code that you are using inside of your question. Don't make people ask for it in comments. I imagine that's why you got downvoted.

绳情 2024-12-07 06:39:59

我不明白这个问题。但这是解决我的问题的事情。

转到 Excel 选项 >保存>以这种格式保存文件>选择“Excel 工作簿(*.xlsx)”。以前,我的工作簿以[兼容模式]打开,现在它们以正常模式打开。 Range 函数可以很好地解决这个问题。

I don't understand the issue. But here is the thing that solved my issue.

Go to Excel Options > Save > Save Files in this format > Select "Excel Workbook(*.xlsx)". Previously, my WorkBooks were opening in [Compatibuility Mode] And now they are opening in normal mode. Range function works fine with that.

心如狂蝶 2024-12-07 06:39:59

仅供参考,尝试应用行样式时出现错误......

wSheet.Rows(y).Style = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red)

Just FYI, got the error trying to apply row style....

wSheet.Rows(y).Style = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red)
陪你到最终 2024-12-07 06:39:59

无法回复/认可此答案,因此在此发帖:

事实上,将数据从一个范围移动到另一个范围时源/目标范围的格式也可能导致此错误。

就我而言,我想要复制的范围包含一个日期格式的列,并且该列包含一个具有无效日期值的单元格(由于其值为负整数,它甚至没有被格式化)。因此,两个范围之间的复制操作在所述单元格处停止,从而产生此处讨论的错误消息。

我的解决方案是使用 Range.Value2 而不是 Range.Value,这会导致 Excel 绕过将单元格格式化为日期(更多详细信息 此处)。但是,这将使您的日期和时间列显示为整数和小数。但是,如果您通过相应设置 Range/Column/Cell.NumberFormat 属性知道在何处期望日期和时间值,则可以将格式更改为所需的格式。

Not being able to reply to/endorse this answer, so posting here:

Indeed, the format of the source/destination ranges when moving data from one range to another might cause this error as well.

In my case, the range I wanted to copy contained a date formatted column, and the column contained one cell with an invalid date value (it was not even formatted due to its value, which was a negative integer). So the copy operation between the two ranges was halting at the said cell yielding the very error message discussed here.

The solution in my case was to use Range.Value2 instead of Range.Value, which caused Excel to bypass formatting the cell as a date (more details here). However, this will render your date and time columns to display as integers and decimals. You will, however, be able to change the formats to the desired ones if you know where to expect the date and time values by setting their Range/Column/Cell.NumberFormat property accordingly.

追风人 2024-12-07 06:39:59

这并没有直接回答问题,但我在打开 xlsx 文件时遇到此错误。问题是我在文件路径中使用了正斜杠。另请参阅https://stackoverflow.com/a/24635904/5932003。它过去可以在以前版本的 Excel 中运行,但不能在版本 1711(内部版本 8730.2127)中运行。

我能够使用 IDispatch->Invoke(..., EXCEPINFO, ...) 诊断问题。 EXCEPINFO 对象包含对错误原因的有用描述。我在 C++ 领域,但我怀疑类似于此 SO 帖子的 C# 代码可以解决问题:用 C# 中的参数封装 IDispatch 调用(使用 DISPPARAMS)

This isn't directly answering the question, but I was getting this error when opening an xlsx file. The problem was that I was using forward slashes in my file path. See also https://stackoverflow.com/a/24635904/5932003. It used to work in previous versions of Excel, but not with Version 1711 (Build 8730.2127).

I was able to diagnose the problem using IDispatch->Invoke(..., EXCEPINFO, ...). The EXCEPINFO object contained a useful description of what went wrong. I was in C++ land, but I suspect that C# code similar to this SO post will do the trick: Packaging IDispatch Invoke with Parameters in C# (with DISPPARAMS).

红墙和绿瓦 2024-12-07 06:39:59

当我尝试在 VS 2017 中保存在 .Net 应用程序中创建的 Excel 文件时,收到此错误代码 0x800A03EC。我更改了 Excel.Application 对象属性 Visible=True 并让它运行直到出现故障。尝试在 Excel 中手动完成这些步骤,然后发现由于缺少文件夹权限而无法保存文件。我向该文件夹添加了写入权限,错误就消失了。

I received this error code 0x800A03EC when trying to save an Excel file created within my .Net application in VS 2017. I changed the Excel.Application object property Visible=True and let it run until the point of failure. Tried to finish the steps manually in Excel and then discovered I could not save the file because of missing folder permissions. I added the Write permission to the folder, and the error went away.

纵山崖 2024-12-07 06:39:59

对于像我这样有同样例外的人:

如果您尝试传递 null 值而不是 Missing.Value (或 Type.Missing),也可能会发生这种情况,

例如

Worksheet worksheet = ...;
return worksheet.Range["A1", null]; //This call generates the error 0x800A03EC

return worksheet.Range["A1", Missing.Value]; //This works correctly

For others like me, who have the same exception:

It can also happen if you try to pass a null value instead of Missing.Value (or Type.Missing)

e.g.

Worksheet worksheet = ...;
return worksheet.Range["A1", null]; //This call generates the error 0x800A03EC

return worksheet.Range["A1", Missing.Value]; //This works correctly
罗罗贝儿 2024-12-07 06:39:59

2021年,当我遇到这个问题时。原因实际上是:

对于 Excel 范围或单元格,我试图直接添加/删除注释,而不检查是否有注释与之绑定。

错误代码是:

if ( comments_string.Length != 0)
{     range.AddComment( comments_string);
}

工作代码是:

if ( comments_string.Length != 0)
{     if (range.Comment != null) range.Comment.Delete();
     range.AddComment(comments_string);
}

in 2021, when i got this problem. the reason actually is:

for a Excel range or cell, i was trying to add/delete comment directly without checking whether there is a comment binding with it or not.

error code is:

if ( comments_string.Length != 0)
{     range.AddComment( comments_string);
}

working code is:

if ( comments_string.Length != 0)
{     if (range.Comment != null) range.Comment.Delete();
     range.AddComment(comments_string);
}
百善笑为先 2024-12-07 06:39:59

当我尝试将单元格数组分配给 range.Value 时,我遇到了确切代码错误。就我而言,这是数据格式错误的问题。单元格的数据格式设置为日期,但用户犯了一个错误,输入的日期不是“20.02.2013”​​,而是“20.02.0213”。 Excel 的 COM 对象拒绝采用年份“0213”并引发此错误的异常。

I had an error with exact code when I tried to assigned array of cells to range.Value. In my case it was the problem with wrong data format. The cell's data format was set as DATE but the user made an error and instead of "20.02.2013" entered date "20.02.0213". The Excel's COM object refused taking year '0213' and threw exception with this error.

嗳卜坏 2024-12-07 06:39:59

当我开发一个将项目内容导出到 Excel 文件的应用程序时,我也遇到了同样的问题。

我在论坛中找不到我的问题的解决方案,然后我检查了 Excel 的最大容量,发现下面的链接显示

“工作表大小 1,048,576 行 x 16,384 列”,这就是我的情况的问题,我导出的容量不止于此行。请参阅以下链接了解详细信息

http://answers.microsoft.com/en-us/office/forum/office_2013_release-excel/with-excel-2013how-many-rows-will-this-contain/271264fb-3ab8-4c5b- aa0d-7095c5ac6108

问候
普拉尚特·尼夫

I also faced the same issue, when I was developing a application which exports project contents into excel file.

I could not found the resolution in forums for my problem, then I check the maximum capacity of excel and found below link which says

"Worksheet size 1,048,576 rows by 16,384 columns" and this was the issue in my case, I was exporting more than that rows. Refer below link for details

http://answers.microsoft.com/en-us/office/forum/office_2013_release-excel/with-excel-2013how-many-rows-will-this-contain/271264fb-3ab8-4c5b-aa0d-7095c5ac6108

Regards
Prashant Neve

森林迷了鹿 2024-12-07 06:39:59

执行以下语句时出现相同的错误代码:

sheet.QueryTables.Add("TEXT" & Path.GetFullPath(fileName), "1:1", Type.Missing)

原因是“TEXT”后面缺少分号 (;)。

这是正确的:

sheet.QueryTables.Add("TEXT;" & Path.GetFullPath(fileName), "1:1", Type.Missing)

I had the same error code when executing the following statement:

sheet.QueryTables.Add("TEXT" & Path.GetFullPath(fileName), "1:1", Type.Missing)

The reason was the missing semicolon (;) after "TEXT".

Here is the correct one:

sheet.QueryTables.Add("TEXT;" & Path.GetFullPath(fileName), "1:1", Type.Missing)
追我者格杀勿论 2024-12-07 06:39:59

我收到此异常是因为我输入了:

ws.get_Range("K:K").EntireColumn.AutoFit();
ws.get_Range("N:N").EntireColumn.AutoFit();
ws.get_Range("0:0").EntireColumn.AutoFit();

看到错误了吗?
提示:Excel 接受从 1 开始的索引,但不像 C# 那样从 0 开始。

I got this exception because I typed:

ws.get_Range("K:K").EntireColumn.AutoFit();
ws.get_Range("N:N").EntireColumn.AutoFit();
ws.get_Range("0:0").EntireColumn.AutoFit();

See a mistake?
Hint: Excel is accepting indexing from 1, but not from 0 as C# does.

美煞众生 2024-12-07 06:39:59

我收到此错误是因为我尝试重命名包含太多字符的工作表

I got this error because I tried to rename a sheet with too many characters

始终不够 2024-12-07 06:39:59

我同意 Hugh W 的帖子“我得出结论,相同的错误代码用于指示多个不相关的问题”

其他帖子没有提到如果工作表被锁定,此错误会频繁发生。虽然我没有测试每种情况,但如果您尝试在工作表锁定时通过 VSTO/Com 执行此操作,则似乎在锁定工作表时在 excel 中无法执行的任何操作都会引发此错误。 EG 更改任何样式工件(字体、字体大小、颜色、下划线)、更改 Excel 验证、更改列宽、行高、公式

I agree with Hugh W post "I conclude that the same error code is used to indicate multiple unrelated problems"

Other posts have not mentioned that this error occurs frequently if the worksheet is locked. While I haven't tested every scenario, it seems that anything that you can not do in excel when a worksheet is locked with throw this error if you attempt to do it via VSTO/Com while the sheet is locked. E.G. Changing any style artifact (font, font size, colour, underline), changing the Excel Validation, changing the column widths, row heights, formulas

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文