MS Word VBA - select range, check spelling and accept first suggest
i'd like to write a macro that selects the next word to the right of the cursor, checks its spelling and replaces an error with the fir开发者_开发问答st suggestion..
can anyone with more VBA knowledge than me (..laugh) help out.
i tried the macro recorder but did not get any farther than this:
Sub FirstSuggest()
Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
...
...
End Sub
thanks, kay
Dim r As Range
Set r = Selection.GoToNext(wdGoToSpellingError)
With r.GetSpellingSuggestions()
If .Count > 0 Then
r.Text = .Item(1).Name
End If
End With
精彩评论