我想通过提取包含Word文档中粗体字的句子来构建术语列表。那可能吗?我知道如何以粗体查找单词。但我不知道如何选择有粗体字的句子。是否可以从包含粗体字的Word文档中提取句子?
我添加了一些代码来将找到的文本复制并粘贴到新文档中。它工作正常,但现在不是。我不知道为什么。这是我现在有:
Sub Extract_terms()
With Selection.Find
.Format = True
.Font.Bold = True
End With
Do While Selection.Find.Execute
Selection.Expand wdSentence
Selection.Font.Bold = False 'added to prevent infinite loop
Selection.Copy
Windows("list.docx").Activate
Selection.PasteAndFormat (wdFormatOriginalFormatting)
Selection.TypeParagraph
Windows("Chapter 3.docx [Compatibility Mode]").Activate
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Loop
End Sub
我注意到,当行Do While Selection.Find.Execute运行时,光标停止,而不是找到粗体文本。 – aoswald