我知道如何在Word文档中获取每个段落。但是我正在寻找一种方法来循环遍历MS Word文档中的每个单词。
Sub Sample()
Dim apara As Paragraph
Dim lineText As String
For Each apara In ActiveDocument.Paragraphs
lineText = apara.Range
'Now print the paragraph
Debug.Print lineText
Next apara
End Sub
For Each sentence In ActiveDocument.StoryRanges
For Each w In sentence.Words
Debug.Print w
Next
Next
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句