by Masood Siddiqui (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 2nd December 2002
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Spelling Grammar Check.
1. From the Project menu, click References.
2. To include the Microsoft Word 8.0 Object Library in your project, make sure
that there's an "x" in the check box next to its listing, and then click OK.
3. Double-click the Check Spelling button, and then type the following program
code in the Code window:
Dim X As Object 'create Word object
Set X = CreateObject("Word.Application")
X.Visible = False 'hide Word
X.Documents.Add 'open a new document
X.Selection.Text = Text5.Text 'copy text box to document
X.ActiveDocument.CheckGrammar 'run spell/grammar checker
Text5.Text = X.Selection.Text 'copy corrected text to VB
X.ActiveDocument.Close SaveChanges:= wdDoNotSaveChanges
X.Application.Quit 'quit Word
Set X = Nothing 'release object variable