Range.HasRichDataType 属性 (Excel)Range.HasRichDataType property (Excel)

如果区域中的所有单元格均包含 RTF 数据类型,则为 TrueTrue if all cells in the range contain a Rich data type. 如果区域中的单元格都不包含丰富的数据类型, 则为 False; 否则为False 。否则为 nullFalse if none of the cells in the range contains a Rich data type; otherwise, null. 只读 Variant 类型。Read-only Variant.

语法Syntax

表达式HasRichDataTypeexpression.HasRichDataType

expression 一个表示 Range 对象的变量。expression A variable that represents a Range object.

注解Remarks

链接数据类型 (例如股票或地理位置) 是一种丰富的数据类型。Linked data types, such as Stocks or Geography, are a kind of Rich data type.

对于链接类型, 只有其**LinkedDataTypeState** 属性为xlLinkedDataTypeStateValidLinkedDataxlLinkedDataTypeStateFetchingDataXlLinkedDataTypeStateBrokenLinkedData的单元格将计为 rtf 格式HasRichDataType属性的数据类型。For linked types, only cells whose LinkedDataTypeState property is xlLinkedDataTypeStateValidLinkedData, xlLinkedDataTypeStateFetchingData, or xlLinkedDataTypeStateBrokenLinkedData will be counted as Rich data types by the HasRichDataType property.

XlLinkedDataTypeStateDisambiguationNeededxlLinkedDataTypeStateNone状态中的单元格_不_计为丰富的数据类型。Cells in the xlLinkedDataTypeStateDisambiguationNeeded or xlLinkedDataTypeStateNone states do not count as Rich data types.

有关可能的链接数据类型状态的详细信息, 请参阅**XlLinkedDataTypeState** 枚举。For more information about possible Linked data type states, see the XlLinkedDataTypeState enumeration.

示例Example

此示例提示用户在 Sheet1 中选择一个区域。This example prompts the user to select a range on Sheet1. 如果所选区域中的所有单元格均包含 RTF 数据类型,则此示例显示一条消息。If every cell in the selected range contains a Rich data type, the example displays a message.

Worksheets("Sheet1").Activate 
Set rr = Application.InputBox( _ 
 prompt:="Select a range on this worksheet", _ 
 Type:=8) 
If rr.HasRichDataType = True Then 
 MsgBox "Every cell in the selection contains a Rich Data" 
End If

支持和反馈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.