Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a VB6.0 project with MDI parent and child form. Now I need to check spelling and grammar in few text boxes on that child form.

Please help with code example.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
146 views
Welcome To Ask or Share your Answers For Others

1 Answer

You could license a professional ActiveX component like Tachyon's spellchecker. I found a list here.

If you could demand Microsoft Word installed on the client machine as prerequisit, you could use Word's spell checker:

Dim objWord As Object
Dim objDoc  As Object

Dim strResult As String

' // Create a new instance of word Application

Set objWord = CreateObject("word.Application")

Select Case objWord.Version
   ' // Office 2000
   Case "9.0"
      Set objDoc = objWord.Documents.Add(, , 1, True)

   ' // Office XP
   Case "10.0"
      Set objDoc = objWord.Documents.Add(, , 1, True)

   ' // Office 97
   Case Else ' Office 97
      Set objDoc = objWord.Documents.Add

End Select

objDoc.Content = Text1.Text
objDoc.CheckSpelling

strResult = Left(objDoc.Content, Len(objDoc.Content) - 1)

If Text1.Text = strResult Then
    ' // There were no spelling errors, so give the user a
    ' // visual signal that something happened

    MsgBox "The spelling check is complete.", vbInformation + vbOKOnly
End If

You can find another good example in this article about how to call the MS Word Spell Checker.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...