borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Data Control / Access 2000 )Next Topic (VB Printing) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Spell Checking
Poster Message
lego687
Level: Guest


icon Spell Checking  Archived to Disk

   I need to add Spell checking into my program, but I don't want to have to pay $100 for VSSpell. Can someone direct me to a place or some code that will help me add in spell checking ability

17-05-2002 at 01:46 PM
| Quote Reply
Mickwj
Level: Guest

icon Re: Spell Checking  Archived to Disk

Hey there
Here is some code I found a while ago. It requires that you have MS Word on the pc. In your project, under References, make sure that Microsoft Word 9.0 Object library is selected.

Next create on a new form, one textbox, three buttons (you will see from the code what to call them) , and a list box.

Option Explicit

Dim MSWord As Word.Application

Private Sub cmdCheck_Click()
Dim strText As String
Dim Suggestion As Word.SpellingSuggestion
Dim colSuggestions As word.SpellingSuggestions

If MSWord.Documents.Count = 0 Then MSWord.Documents.Add
strText = Trim$(txtWord.Text)

lstSuggestions.Clear
If MSWord.CheckSpelling(strText) Then
  lstSuggestions.AddItem "(Correct)"
Else
  Set colSuggestions = MSWord.GetSpellingSuggestions(strText)
  If colSuggestions.Count = 0 Then
    lstSuggestions.AddItem "(No Suggestions)"
  Else
    For Each Suggestion In colSuggestions
      lstSuggestions.AddItem Suggestion.Name
    Next
  End If
End If

End Sub

Private Sub cmdClear_Click()
txtWord.Text = ""
lstSuggestions.Clear
End Sub

Private Sub cmdExit_Click()
End
End Sub

Private Sub Form_Load()
Set MSWord = New Word.Application
End Sub

20-05-2002 at 01:15 AM
| Quote Reply
AndreaVB Forum : VB General : Spell Checking
Previous Topic (Data Control / Access 2000 )Next Topic (VB Printing) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder