简体   繁体   English

xlErrorChecks枚举Office 365 / Excel 2016

[英]xlErrorChecks Enumeration Office 365/Excel 2016

In my current version of Excel, the enumeration of xlNumberAsText seems inconsistent with both the documentation XlErrorChecks Enumeration (Excel) and prior usage recommended on SO. 在我当前的Excel版本中,xlNumberAsText的枚举似乎与文档XlErrorChecks枚举(Excel)和SO上建议的先前用法都不一致。 It seems that particular error is Item 4; 似乎特别的错误是第4项。 whereas previous posts about clearing this error using VBA have used a constant of 3. 而以前有关使用VBA清除此错误的文章使用的常数为3。

在此处输入图片说明

Is this a bug in Excel 2016? 这是Excel 2016中的错误吗? Or am I doing something incorrectly. 还是我做错了什么。

Here is code demonstrating the issue. 这是演示该问题的代码。 And if you examine the worksheet after running the code, it is apparent that the error is flagged, in Excel, as NumberAsText and not as Inconsistent Formula . 并且,如果您在运行代码后检查工作表,很明显,在Excel中,该错误被标记为NumberAsText而不是Inconsistent Formula


Option Explicit

Sub foo()
Dim I As Long
Dim B As Boolean
Dim S As String
Dim R As Range

'Save current state
B = Application.ErrorCheckingOptions.NumberAsText

'Enable
Application.ErrorCheckingOptions.NumberAsText = True

Set R = Cells(1, 1)

With R
    .Clear
    .NumberFormat = "@"
    .Value = "1"
End With

For I = 1 To 10
    S = S & vbLf & I & vbTab & R.Errors(I).Value
Next I
S = Mid(S, 2)

'Restore original state
Application.ErrorCheckingOptions.NumberAsText = B

MsgBox S

End Sub

在此处输入图片说明

And also, in trying to clear the error box, I must use 而且,在尝试清除错误框时,我必须使用

R.Errors(4).Ignore = True  

Neither Errors(3) , nor Errors(xlNumberAsText) will have any affect on the error box. Errors(3)Errors(xlNumberAsText)都不会对错误框产生任何影响。

I've noted other inconsistencies with the enum and the documentation: 我注意到了与枚举和文档的其他不一致之处:

Inconsistent Formula: 5
Wrong Data Type:      2

I'm not going to bother to check the rest. 我不会去检查其余的东西。 But I am going to try to report it to MS. 但我将尝试向MS报告。 Thanks to those who confirmed this problem. 感谢那些确认了这个问题的人。

Followup: I reported this to MS via the Feedback option within Excel. 后续行动:我通过Excel中的“反馈”选项将此报告给了MS。 And after this morning's update, the problem seems to have been corrected. 并且在今天早上的更新之后,该问题似乎已得到纠正。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Excel 2016 Office 365灾难性故障 - Excel 2016 office 365 catastrophic failure “无法设置Window类的FreezePanes属性”Excel 2016(office 365) - “Unable to set the FreezePanes property of the Window class” Excel 2016 (office 365) 在 Excel 2016/365 中使用 office 插件(Javascript API)有条件地添加工作表 - Add a sheet conditionally in Excel 2016/365 with office add-ins (Javascript API) 使用Office 2016 / Office 365的udf问题进行条件格式设置 - Conditional formatting with udf issues with Office 2016 / Office 365 在Office 365上以编程方式编写Excel - Programmatically write Excel on Office 365 Excel for Office 365中的Graph API - Graph API in Excel for Office 365 执行 SAP RFC 的 VBA 程序在 Excel 2016 on-prem 中有效,但在 Office 365 中无效(运行时错误 20080008…Bad Variant Type) - VBA program executing SAP RFCs works in Excel 2016 on-prem, but not in Office 365 (Run-time error 20080008…Bad Variant Type) VBA不在受保护的工作表上更新— Excel Office 365 - VBA not updating on Protected Sheet — Excel Office 365 ExCel (Office 365) 的默认打开模式是否可配置? - Is default open mode for ExCel (Office 365) configurable? 无法添加对Outlook 2016(Office 365)Interop(16.0.0.0)的引用 - Cannot add reference to Outlook 2016 (Office 365) Interop (16.0.0.0)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM