VB6.0 MDI拼写检查器

VB6.0 MDI拼写检查器,vb6,spell-checking,Vb6,Spell Checking,我有一个带有MDI父窗体和子窗体的VB6.0项目。现在我需要检查该子窗体上几个文本框中的拼写和语法 请提供代码示例帮助。您可以授权专业ActiveX组件,如。我找到了一个新的 如果您可以要求在客户端计算机上安装Microsoft Word作为先决条件,则可以使用Word的拼写检查器: Dim objWord As Object Dim objDoc As Object Dim strResult As String ' // Create a new instance of word Ap

我有一个带有MDI父窗体和子窗体的VB6.0项目。现在我需要检查该子窗体上几个文本框中的拼写和语法


请提供代码示例帮助。

您可以授权专业ActiveX组件,如。我找到了一个新的

如果您可以要求在客户端计算机上安装Microsoft Word作为先决条件,则可以使用Word的拼写检查器:

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

您可以在本文中找到另一个关于如何使用的好例子

我想你需要再解释一下。我想Ranajit需要什么是很清楚的。这些代码工作得很好,只是它取消了文本框之前的所有格式。好心的建议。