View Single Post
 
Old 09-22-2017, 09:47 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,387
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by tonyony View Post
1. What would be the difference between the macro you have posted above and this macro below?
Two fundamental difference are that my code:
1. highlights (in Pink) any spelling errors for which there are no suggested corrections; and
2. provides for certain words to be added to an exclusions list so they're highlighted (Green) instead of being replaced.
That's obvious from even a cursory read of the code.
Quote:
Originally Posted by tonyony View Post
2. would there be a way to integrate any of these two macros so that they would ignore words that begin with a capital letter that are being picked up as spelling mistakes , so that those remain unchanged ?
There's nothing to integrate; your macro already does only part of what mine does. As for excluding words with a first capital, you might try something based on:
Code:
Sub AutoSpellCorrect()
Dim Rng As Range, oSuggestions As Variant, StrExcl As String
StrExcl = ",word1,word2,word3,"
For Each Rng In ActiveDocument.Range.SpellingErrors
  With Rng
    If LCase(.Characters.First) = .Characters.First Then
      If InStr(StrExcl, "," & .Text & ",") = 0 Then
        If .GetSpellingSuggestions.Count > 0 Then
          Set oSuggestions = .GetSpellingSuggestions
          .Text = oSuggestions(1)
        Else
          .HighlightColorIndex = wdPink
        End If
      Else
        .HighlightColorIndex = wdBrightGreen
      End If
    Else
      .HighlightColorIndex = wdYellow
    End If
  End With
Next
End Sub
Whether you use any of the highlights is, of course, optional; simply comment-out/delete the ones you don't want.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote