Word,VBA:以编程方式检查范围内的特定样式

Word, VBA: Programmatically check for certain style in range

我有一个范围。在这个范围内是一些文本。我现在可以使用 vba 检测是否在此范围内使用了某种样式(比方说标题 1)?

这可以通过 Selection.Find 方法实现

mySelection.Find.ClearFormatting
mySelection.Find.Style = ActiveDocument.Styles("Heading 1")
With mySelection.Find
        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = False
        .CorrectHangulEndings = False
        .HanjaPhoneticHangul = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = False
        .MatchFuzzy = False
End With
mySelection.Find.Execute