Important alert: (current site time 7/16/2013 1:35:32 AM EDT)
 

winzip icon

AA ***Making an Spelling Checker with VB and Word Updated

Email
Submitted on: 1/23/2001 4:21:14 PM
By: Suresh Singh 
Level: Beginner
User Rating: By 7 Users
Compatibility: VB 6.0
Views: 23471
(About the author)
 
     One of Word's most commonly used features is the ability to check spelling. Word encapusulates this functionality into two methods: CheckSpelling and GetSpellingSuggestions. The GetSpellingSuggestions method is memember function of the Application and range object in Word. CheckSpelling is a member function of Application, Range, and Document object.we can use CheckSpelling to determine whether a word is spelled correctly. If a word is misspelled, we can use the GetSpellingSuggestions method to retune a collection of SpellingSuggestion object for the misspelled word. This program also have a good example of using StatusBar, imagelist and toolbar A vary nice program for Beginners. You must see Screen shot of this program

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 11 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
1/23/2001 5:41:15 PMManas Mukherjee

Hi , Pradeep
Private Sub List1_Click()
'On Error Resume Next
Screen.MousePointer = vbHourglass
Set CorrectionsCollectionCollection = _
AppWord.GetSpellingSuggestions(SpellCollectionSpellCollection.Item _
(List1.ListIndex + 1))
List2.Clear
For iSuggWord = 1 To CorrectionsCollectionCollection.Count
List2.AddItem CorrectionsCollectionCollection.Item(iSuggWord)
Next
Screen.MousePointer = vbDefault
Text1.Text = List1.Text
WordCheck
End Sub

Private Sub WordCheck()
'On Error Resume Next
Dim WordBuff As Variant
Dim replace As String
WordBuff = InStr(mainForm.Text1.Text, SuggestionsForm.Text1.Text)
If WordBuff Then
mainForm.Text1.SelStart = WordBuff - 1
mainForm.Text1.SelLength = Len(SuggestionsForm.Text1.Text)
replace = InputBox(" The word U want to replace")
mainForm.Text1.SelText = CStr(replace) & Space$(2)
mainForm.Text1.SelText = vbRed
Else
MsgBox "Oops"
End If
End Sub

(If this comment was disrespectful, please report it.)

 
1/23/2001 5:45:12 PMManas

Correction: Don't use : Remark it : Sorry>(*|*)_
mainForm.Text1.SelText =
vbRed

(If this comment was disrespectful, please report it.)

 
1/24/2001 11:12:26 AMDoug Gaede

I like the fact that it gives control of the word selection/replacement process over to the program. Suggestions: 1) Use comments everywhere. Summary at the top of every Form/Class, and at the top of every Sub/Function. 2) Move the spell checking code into a class. A form displays and a class processes. Read Deborah Kurata's book on classes and object-oriented programming. 3) Do the word replacement in a string variable using InStr, Mid, Left, etc. Then display it in the text box. 4) Whenever you use Set [Set objSpell = New TextBox], always destroy the object as soon as you are done with it (middle or end of a Sub or at the very least in Form_Unload) [Set objSpell = Nothing]. 5) Your program needs to close the Word application, which is still left running in the background:
objAppWord.Application.Quit False 'close
Set objAppWord = Nothing 'kill object

Hope this helps.
(If this comment was disrespectful, please report it.)

 
1/24/2001 3:45:34 PMDoug Gaede

A note that PSC inserted line breaks in the code at the bottom of my last comment. There is supposed to be a space (not a break) between 'Quit' and 'False' in one line, and then only a space between 'Nothing' and 'kill'.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.