Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-06-2017, 09:58 AM
Alberto Costa Alberto Costa 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 2013
Novice
Automatic full document spell check and correction without user intervention
 
Join Date: Mar 2017
Posts: 3
Alberto Costa is on a distinguished road
Default Automatic full document spell check and correction without user intervention

Hello,
Any clues of how to do this?
Something like this would be perfect...


winword.exe /??? document.docx
Or any other option that does a full document grammar and spell check and the correction without asking word-by-word?
Thank you!

Last edited by Charles Kenyon; 03-07-2017 at 11:30 AM. Reason: added - vba tag at end of title
Reply With Quote
  #2  
Old 03-06-2017, 11:36 AM
Charles Kenyon Charles Kenyon 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 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

You are giving WAY too much credit to the ability of a computer program to make such decisions.

There is no way in Word to do this as a command line option. You could have Word automatically use suggestions from the spelling checker as AutoCorrect. I would advise against doing this. You are likely to regret it if you do.
Reply With Quote
  #3  
Old 03-07-2017, 03:14 AM
Alberto Costa Alberto Costa 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 2013
Novice
Automatic full document spell check and correction without user intervention
 
Join Date: Mar 2017
Posts: 3
Alberto Costa is on a distinguished road
Default

Thank you, but that is a "risk" i must live with
Even without being from the command line, can it be done?
A "yes to all". It is not as you type, the document is already written...
Reply With Quote
  #4  
Old 03-07-2017, 06:07 AM
Charles Kenyon Charles Kenyon 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 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

For spelling, I believe that it could be done through a macro. And, I suppose the macro could be run through the command-line interface, now that I think of it. For grammar, there is no way, because for most grammar points, there are not suggestions.

I do not have the skill to write such a macro but someone else on the forum may.

The "risk" is very real. It is highly likely that Word will make a document worse rather than better without a human brain making decisions. Search the Internet for "Stupid AutoCorrect" for some idea of what can happen.
Reply With Quote
  #5  
Old 03-07-2017, 10:23 AM
Alberto Costa Alberto Costa 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 2013
Novice
Automatic full document spell check and correction without user intervention
 
Join Date: Mar 2017
Posts: 3
Alberto Costa is on a distinguished road
Default

To give more context, it is a document library with half a million documents that have more errors than any machine can do (i have read some of them.. outch!) it is not the core of the project, but it is very important for the rest of the project.
Any pointers to where to look about the creation of that macro?
Thank you very much!
Reply With Quote
  #6  
Old 03-08-2017, 05:29 AM
Charles Kenyon Charles Kenyon 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 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

I have moved this thread to the Word vba forum. I removed the grammar correction from the title because I don't think it is possible. Choosing the first spelling suggestion may be.

Again, I think you are asking for trouble.
Reply With Quote
  #7  
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: 21,962
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
  #8  
Old 03-08-2017, 04:38 PM
gmaxey gmaxey is offline Automatic full document spell check and correction without user intervention Windows 7 32bit Automatic full document spell check and correction without user intervention Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,428
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

I have to agree with Paul and Charles. It is futile. Here is a few simple misspelled words before and after Paul's macro:


Teet - Test
Teeeesssssttttt - Test
Teessst - Test
Taaart - Tart
Tarrrrt -Tart
Wiescougowizc

Tet Test
Teeeesssssttttt Test
Teesta Test
Teacart Tart
Turret Tart
Wiescougowizc


Edit: In the text above after running Paul's macro the second listed word is highlighted pink and the last (added as an exception) is highlighted green.

Now the text has four wrong words instead of four misspelled words. Are you any better off? Here you can clearly see what and where they are wrong and correct them manually. In a million documents, you might as well roll up your sleeves and manually correct them in the first place.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/

Last edited by gmaxey; 03-08-2017 at 07:12 PM.
Reply With Quote
  #9  
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
  #10  
Old 09-22-2017, 09:11 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: 21,962
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
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.
I'd have thought my previous reply made that clear enough - VBA has no GetGrammarSuggestions equivalent to GetSpellingSuggestions.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 09-22-2017, 09:21 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
VBA has no GetGrammarSuggestions equivalent to GetSpellingSuggestions.
That's what I thought.. Hence, no way to accept automatically Word's suggestions on grammar? Do I have to run the Spell&Grammar check and go through one by one?
Reply With Quote
  #12  
Old 09-22-2017, 09:23 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: 21,962
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
Do I have to run the Spell&Grammar check and go through one by one?
Apparently. Although a macro could be used, the best it might do is highlight the issues; you'd then have to decide what to do about them.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #13  
Old 09-22-2017, 09:31 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
Apparently. Although a macro could be used, the best it might do is highlight the issues; you'd then have to decide what to do about them.
Thanks very much for your help

I would have 2 last questions if you could be so kind as to reply

1. What would be the difference between the macro you have posted above and this macro below?

Sub AcceptSpellingSuggestions()
Dim er As Range
For Each er In ActiveDocument.SpellingErrors
If er.GetSpellingSuggestions.Count > 0 Then
er.Text = er.GetSpellingSuggestions.Item(1).Name
End If
Next
End Sub

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 ?
Reply With Quote
  #14  
Old 09-22-2017, 09:47 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: 21,962
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
  #15  
Old 09-22-2017, 09:57 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: 21,962
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

Cross-posted (all three topics) at: https://answers.microsoft.com/en-us/...c-c62c0f69c717
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
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 06:49 PM.


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