-1

我想在 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
4

1 回答 1

1

您不需要 Do While 循环。这是你正在尝试的吗?

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
于 2012-07-26T06:09:39.240 回答