题
我想在Word中检查整个页面的这种情况。
If Options.CheckGrammarWithSpelling = True Then
Selection.Comments.Add Range:=Selection.Range
Selection.TypeText Text:="WRONG!!!"
'ActiveDocument.CheckGrammar
Else
'ActiveDocument.CheckSpelling
'Selection.Comments.Add Range:=Selection.Range
End If
. 解决方案
你不需要在循环时做。这是你尝试的吗?
Sub DoSpellCheckAndComment()
Dim oWord As Range
Dim StoryRange As Range
For Each StoryRange In ActiveDocument.StoryRanges
Application.CheckSpelling Word:=StoryRange
For Each oWord In StoryRange.Words
If Not Application.CheckSpelling(Word:=oWord.Text) Then
oWord.Select
oWord.Comments.Add Range:=Selection.Range, Text:="WRONG!!!"
End If
Next oWord
Next StoryRange
End Sub
. 不隶属于 StackOverflow