Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
148 views
in Technique[技术] by (71.8m points)

VB6.0 MDI Spell Checker

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

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

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...