How to use MS Word Spell Checker
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 'MS Office - How to use MS Word Spell Checker 'Add a Command Button and a Text Box to your form and set the text box Multiline property to True. Private Sub Command1_Click() Dim objWord, tmpObjWord, strResults 'Only continue if user has typed text into the text box. If Len(Text1.Text) < 1 Then Exit Sub Set tmpObjWord = CreateObject("Word.Application") ' check if there are any spelling errors. If tmpObjWord.CheckSpelling(Text1.Text) Then MsgBox "No Spell Errors found." Set tmpObjWord = Nothing Exit Sub End If Set tmpObjWord = Nothing Set objWord = CreateObject("Word.Application") With objWord .Visible = False 'Add new document in word .Documents.Add 'add the text to that document .Selection.TypeText Text1.Text 'No need to check grammar now .Options.CheckGrammarWithSpelling = False .Options.IgnoreUppercase = False 'check spelling .ActiveDocument.CheckSpelling 'Select the new, corrected text .Selection.WholeStory 'Copy Corrected text to Clipboard .Selection.Copy 'strResults holds the text after the spell corrections strResults = .Selection.Text 'close the document .ActiveDocument.Close (0) 'quit the word application .Quit End With Set objWord = Nothing 'retrieve the corrected text from the clipboard Text1.Text = Clipboard.GetText End Sub |
Related posts:
- How to create MS Word Document from your Program
- How to add text to Microsoft Word documents from VB
- How to use Microsoft Word to print output from VB
- How to use MS Word’s Spelling Corrector within VB
- VB6 Tutorial NotePad Word Pad
- How to Search for a word in a Text box.
- How to Use Access data to make a Word table
- How to toggle Word wrap feature on Rich Text Box
- How to copy/cut the content of the text box to the clipboard
- VB6 Tutorial Connection Checker








