VB6.0 MDI 拼写检查器 [英] VB6.0 MDI Spell Checker
本文介绍了VB6.0 MDI 拼写检查器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有 MDI 父子窗体的 VB6.0 项目.现在我需要在该子表单的几个文本框中检查拼写和语法.
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.
请帮忙提供代码示例.
推荐答案
您可以许可专业的 ActiveX 组件,例如 Tachyon 的拼写检查器.我在此处找到了一个列表.
You could license a professional ActiveX component like Tachyon's spellchecker. I found a list here.
如果您可以要求在客户端计算机上安装 Microsoft Word 作为先决条件,则可以使用 Word 的拼写检查器:
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
您可以在本文中找到另一个关于如何调用 MS Word 拼写检查器.
You can find another good example in this article about how to call the MS Word Spell Checker.
这篇关于VB6.0 MDI 拼写检查器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文