Excel 拼写检查并在下一个单元格中获取建议列表

Excel 拼写检查并在下一个单元格中获取建议列表,excel,vba,Excel,Vba,我正在使用下面的代码在一个范围内进行拼写检查 Sub SpellCheck() Application.SpellingOptions.DictLang = 1033 Dim cel As Range, CellLen As Long, CurChr As Long, TheString As String Dim a As Integer For Each cel In Range("Spell[description]") 'splitting paragraph into word

我正在使用下面的代码在一个范围内进行拼写检查

Sub SpellCheck()

Application.SpellingOptions.DictLang = 1033

Dim cel As Range, CellLen As Long, CurChr As Long, TheString As String
Dim a As Integer

For Each cel In Range("Spell[description]")

'splitting paragraph into words

    For CurChr = 1 To Len(cel.Value)
        If Asc(Mid(cel.Value, CurChr, 1)) = 32 Then
            If InStr(CurChr + 1, cel.Value, " ") = 0 Then
                TheString = Mid(cel.Value, CurChr + 1, Len(cel.Value) - CurChr)
            Else
                TheString = Mid(cel.Value, CurChr + 1, InStr(CurChr + 1, cel.Value, " ") - CurChr)
            End If
            'checking spell as per words
            If Not Application.CheckSpelling(Word:=TheString) Then

                cel.Characters(CurChr + 1, Len(TheString)).Font.Color = RGB(255, 0, 0)
                'updating the error words in the next sheet
                Sheets(2).Activate
                a = Cells(Rows.Count, 1).End(xlUp).Row
                Cells(a + 1, 1).Value = cel.Offset(0, -1).Value
                Cells(a + 1, 2).Value = TheString
            Else
                cel.Characters(CurChr + 1, Len(TheString)).Font.Color = RGB(0, 0, 0)
            End If
            TheString = ""
        End If
    Next CurChr

Next cel

End Sub
它将以红色突出显示错误字,并在sheet2中随ID和错误字一起更新。但是,我需要在下一个单元格中更新excel为错误提供的建议值(在sheet2中的错误词之后)


我对VBA中的这个拼写检查是完全陌生的,有人能帮我吗

我认为Excel/VBA不提供对拼写建议的编程访问。你可能会考虑使用一个MS Word对象上的自动化创建一个黑客攻击,并使用它的自动更正。哦,谢谢你的更新:一个小问题是在拼写检查的情况下,可以改变拼写错误来将它改为正确的单词吗?我不认为Excel /VBA提供了对拼写建议的编程访问。你可能会考虑使用一个MS Word对象上的自动化创建一个黑客攻击,并使用它的自动更正。哦,谢谢你的更新:一个小问题是在拼写检查没有提示的情况下,有可能改变拼写错误来将其改为正确的单词吗?