检查段落字体样式是否为斜体?

时间:2014-09-22 09:28:39

标签: vba ms-word word-vba

我想找到一个段落是否为斜体,我通过for循环迭代到所有段落,如果段落是斜体,我想做一些操作。

For Each oPara In .Paragraphs
    With oPara
      If oParaAttrItalic = True Then
          .Style = "new_style"
      End If
    End With
Next

1 个答案:

答案 0 :(得分:1)

您需要使用Paragraph.Range参考

Dim oPara As Paragraph

For Each oPara In ActiveDocument.Paragraphs
    If oPara.Range.Font.Italic = True Then
        'Do something
    End If
Next oPara