Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-08-2017, 03:18 PM
macropod's Avatar
macropod macropod is offline Automatic full document spell check and correction without user intervention Windows 7 64bit Automatic full document spell check and correction without user intervention Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,514
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

Yes, it's possible to write such a macro, but the results would be unreliable at best. First, there's the question of whether the word is actually misspelt - it might be a place name, a person's name, or a technical word not found in Word's spell-check dictionary. Then, even if it is misspelt, the there's the question of whether spell-check could identify which of a number of possibilities (if any) the correct spelling might be; simply picking the first possibility might be worse than leaving it alone... And what if the misspelling was in the source (perhaps deliberately)!??



That said, the following macro automatically corrects spelling errors in a document, using the first-suggested word from the spelling dictionary, unless the word is found in the macro’s exclusions list. Words in the exclusion list get bright green highlighting and other words, for which no correction can be found, get pink highlighting.
Code:
Sub AutoSpellCorrect()
Dim Rng As Range, oSuggestions As Variant, StrExcl As String
StrExcl = ",word1,word2,word3,"
For Each Rng In ActiveDocument.Range.SpellingErrors
  If InStr(StrExcl, "," & Rng.Text & ",") = 0 Then
    If Rng.GetSpellingSuggestions.Count > 0 Then
      Set oSuggestions = Rng.GetSpellingSuggestions
      Rng.Text = oSuggestions(1)
    Else
      Rng.HighlightColorIndex = wdPink
    End If
  Else
    Rng.HighlightColorIndex = wdBrightGreen
  End If
Next
End Sub
Caveat Emptor! The National Library of Australia has OCR'd millions of pages from newspapers and engaged a team of volunteer proof-readers over many years to go through them all an manually correct the spelling mistakes. This major institution - with far more $ and expertise to throw at the matter than you or I - recognised that relying on an automated spell-check just wouldn't do the job to the standard required. The project is ongoing.

As for grammar corrections - aside from the fact there's no way to automate this, why would you want to do anything about the grammar of the source material? It is what it is!
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 09-22-2017, 08:58 PM
tonyony tonyony is offline Automatic full document spell check and correction without user intervention Windows 10 Automatic full document spell check and correction without user intervention Office 2016
Novice
 
Join Date: Sep 2017
Posts: 4
tonyony is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
That said, the following macro automatically corrects spelling errors in a document, using the first-suggested word from the spelling dictionary, unless the word is found in the macro’s exclusions list. Words in the exclusion list get bright green highlighting and other words, for which no correction can be found, get pink highlighting.
Thank you for this! It works very well

Quote:
Originally Posted by macropod View Post
As for grammar corrections - aside from the fact there's no way to automate this, why would you want to do anything about the grammar of the source material? It is what it is!
Hi, the VBA code you have generated fixes the spelling mistakes but doesn't solve the issue with the Grammatical errors that come up when for example i have left a space between a word and a comma. For example if I write

"I went shopping , but i did not buy anything"

There would be a blue line because I left a space before the comma. Now the problem is not the blue line, the problem is that I would like to find a way to accept Word's grammatical suggestions. Is there a way to integrate the Macro so that it also accepts the first suggestion for grammar errors/blue lines (integrating the spelling errors which the macro you created so brilliantly does)?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Protected Document (Form) that allows Spell Check beve56 Word 3 03-21-2014 06:15 PM
Spell check checking only part of document Adeyo Word 1 02-24-2013 10:49 PM
Spell Check without User intervention looney001 Outlook 0 01-10-2013 12:41 AM
Spell Check Not Working For Particular User newman Outlook 0 11-18-2012 08:45 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:52 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft