0

VBA スクリプトを使用して、特定のスタイルのすべてのテキスト要素を抽出する必要があります。そのスタイルが行内に存在する場合は行を印刷できますが、そのスタイルに一致するテキストのみを印刷する必要があります。

Dim singleLine As Paragraph
Dim lineText As String

For Each singleLine In ActiveDocument.Paragraphs
    lineText = singleLine.Range.Text

    'Define the style we're searching for
    Dim blnFound As Boolean
    With singleLine.Range.Find
    .style = "Gloss in Text"

    Do
        'if we find the style "Gloss in Text" in this line
        blnFound = .Execute
        If blnFound Then
            Debug.Print lineText 
            Exit Do
        End If
        Loop
    End With

Next singleLine

行全体ではなく、「テキストの光沢」スタイルでタグ付けされたテキストの値のみを印刷するにはどうすればよいですか?

4

1 に答える 1