DisplayErrorString 属性 (Excel)PivotTable.DisplayErrorString property (Excel)

如果数据透视表在有错误的单元格中显示用户自定义的错误字符串,则该值为 TrueTrue if the PivotTable report displays a custom error string in cells that contain errors. 默认值为 FalseThe default value is False. 读/写 BooleanRead/write Boolean.



_表达式_一个代表**PivotTable** 对象的变量。expression A variable that represents a PivotTable object.


使用**ErrorString** 属性可设置自定义错误字符串。Use the ErrorString property to set the custom error string.

当透视处理计算字段时,该属性对于消除被零除错误尤其有用。This property is particularly useful for suppressing divide-by-zero errors when calculated fields are pivoted.


本示例使数据透视表在有错误的单元格中显示连字符。This example causes the PivotTable report to display a hyphen in cells that contain errors.

With Worksheets(1).PivotTables("Pivot1") 
 .ErrorString = "-" 
 .DisplayErrorString = True 
End With

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.