PDA

View Full Version : How to use Application.CheckGrammar



noclass1980
02-07-2018, 08:28 AM
I was looking for a way to check the spelling of a Reviewers Comments in Word but was unsuccessful. I have written code that can identify spelling errors in a Comment and allow the user to type in the correct spelling to remove the spelling error. The code works by using Application.CheckSpelling(commenttext) to determine if there is a spelling somewhere in the text string. It then iterates through each word to find the spelling mistake. This works perfectly.

However, using the same approach with Application.CheckGrammar, it can find that there is a grammatical error in the comment text but cannot tell me what the error is. The example is: "This is comment thee", obviously it should be "three", the Application.CheckSpelling(commenttext) returns False because of the error but cannot tell be it is because the word is thee not three.

Does anyone have any suggestions. Thanks in advance.

macropod
02-07-2018, 08:58 PM
There is no need to process each word to find the spelling error. You might want to read the discussion at: http://www.msofficeforums.com/word-vba/34652-automatic-full-document-spell-check-correction-without.html

As noted there, though,
VBA has no GetGrammarSuggestions equivalent to GetSpellingSuggestions

noclass1980
02-08-2018, 02:46 AM
Thanks, interesting thread.

celinedion
04-24-2023, 12:36 AM
Unfortunately, Microsoft Word's grammar-checking functionality does not have a built-in method to highlight specific grammatical errors in the same way that it highlights spelling errors. Instead, when Word detects a grammatical error, it simply underlines the entire phrase or sentence in green.
mapquest driving directions (https://mapquestdrivingdirections.app)

Aussiebear
04-24-2023, 12:39 AM
Welcome to the VBAX forum CelineDion. This thread is getting a little old. If you feel the need to contribute, please consider starting a new thread.

celinedion
04-24-2023, 07:24 PM
Aussiebear, thanks you!