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
ashtrayAsked:
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.

amebaCommented:
5 / 8
0
jjmartinCommented:
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.
0
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!

mcriderCommented:
This microsoft URL whows you how to spellcheck...

HOWTO: Use the Word 6.0 SpellChecker Via OLE Automation in Visual Basic
http://support.microsoft.com/support/kb/articles/Q147/8/18.asp 

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.
0
twardCommented:
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 '    
FileName = "C:\WINDOWS\TEMP\TEMP.TXT"
RichText1.LoadFile FileName, rtfText
DoEvents

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

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

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
0

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
RuchiCommented:
Ashtray: Where are you? Please say something so we could be of any help to you.
0
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.