如果为 True,则指定的样式是一个已在文档中修改或应用的内置样式,或者是在文档中新建的样式。Boolean 类型,只读。
expression.InUse
expression 必需。该表达式返回一个 Style 对象。
本属性并不一定表明该样式当前是否已应用于文档中的文本。例如,删除一个应用了该样式的文本后,该样式的 InUse 属性仍然为 True。对于尚未在文档中使用过的内置样式,本属性返回 False。
本示例显示一个消息框,列出活动文档中当前正在使用的所有样式的名称。
Dim docActive As Document Dim strMessage As String Dim styleLoop As Style Set docActive = ActiveDocument
strMessage
= "Styles in use:" & vbCr For Each styleLoop In
docActive
.Styles If styleLoop.InUse = True Then With
docActive
.Content.Find .ClearFormatting .Text = "" .Style = styleLoop .Execute Format:=True If .Found = True Then
strMessage
=
strMessage
& styleLoop.Name & vbCr End If End With End If Next styleLoop MsgBox
strMessage