Spell Checker in a Visual Basic Program

Hello all,

l want to known if it is possible to have a spell checker in a vb application, if so, has anyone got some code l could use or give me directions on where l could find some.

lm using VB 5.

regards Ashtray
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

5 / 8
There is a method that uses MS Words spellcheck function that can be integrated into a VB app, if that will fit you needs.  However, this requires that MS Word be installed on the target PC in order for spell check to work in your program.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

This microsoft URL whows you how to spellcheck...

HOWTO: Use the Word 6.0 SpellChecker Via OLE Automation in Visual Basic

By the way, in the example microsoft gave, there's something missing...
After the line:

        MsgBox "Spell Check is complete"

Add the following:

        oWDBasic.FileClose 2
        Set oWDBasic = Nothing

That will close word.
Here is some code that I know works to spell check using word:

Public Sub SpellCheck()
Dim oWDBasic As Object
Dim FileName As String

' Open Word '  
Set oWDBasic = CreateObject("Word.Basic")

' Load Text File into Rich Text Box '    
RichText1.LoadFile FileName, rtfText

' Load File into Word '
oWDBasic.Insert RichText1.Text
' Spell Check the File '

' Get text back into Rich Text Box '
oWDBasic.SetDocumentVar "MyVar", oWDBasic.Selection

sTmpString = oWDBasic.GetDocumentVar("MyVar")

sTmpString = Replace(Left(sTmpString, Len(sTmpString) - 1), vbCr, vbCrLf, 1, -1, vbTextCompare)

' Only Save it if it has changed '
If RichText1.Text <> sTmpString Then
  RichText1.Text = sTmpString
  RichText1.SaveFile FileName, rtfText
End If

' Close File in Word '    
oWDBasic.FileClose 2

' Close Word '    
oWDBasic.FileQuit 2
Set oWDBasic = Nothing
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ashtray: Where are you? Please say something so we could be of any help to you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.