感谢您使用微软产品。您可以使用OLE Automation来调用Word,以下有一篇文章您可以参考一下:
How to Use (OLE) Automation with Word
(http://support.microsoft.com/support/kb/articles/Q184/9/74.ASP)- 微软亚洲技术中心 VB技术支持本贴子仅供CSDN的用户作为参考信息使用。其内容不具备任何法律保障。您需要考虑到并承担使用此信息可能带来的风险。具体事项可参见使用条款 (http://www.csdn.net/microsoft/terms.shtm)。

解决方案 »

  1.   

    Option Explicit
    Dim Doc As New Document
    Dim Visi As Boolean'拼写检查
    Private Sub Command1_Click()
        Form1.Caption = "拼写检查"
        Doc.Range.Text = Text1
        '确定范围
        Doc.Application.Visible = True              '将Word 97变为可见
        AppActivate Doc.Application.Caption
    '激活Word 97
        Call CheckSpell(Text1.Text)                     '拼写检查
        Text1 = Doc.Range.Text
        Text1 = Left(Text1, Len(Text1) - 1)
        AppActivate Caption
    End Sub'统计单词数
    Private Sub Command2_Click()
    Dim Dlg As Word.Dialog
        Doc.Range = Text1.Text
        Set Dlg = Doc.Application.Dialogs(wdDialogDocumentStatistics)
        Dlg.Execute                                 '统计单词和字符
    Form1.Caption = "单词数:" & Str(Dlg.Words) & "词" & Str(Dlg.Characters) & "字符"  '显示统计结果
    End SubPrivate Sub Form_Load()
         Form1.Caption = "调用Word 97"
         Text1.Text = ""
         Command1.Caption = "拼写检查"
         Command2.Caption = "统计单词"
         '使应用程序可见
         '‘Visi = Doc.Application.Visible
    End Sub'关闭应用程序
    Private Sub Form_Unload(Cancel As Integer)
    If Visi Then                    '关闭文件
        Doc.Close savechanges:=False
        Else
        Doc.Application.Quit savechanges:=False             '关闭 Word 97
         End If
    End SubFunction CheckSpell(IncorrectText As String) As String
    Dim Word As Object, retText$
    On Error Resume Next
    '建立对象并打开 WORD
    Set Word = CreateObject("Word.Basic")
        '把需要检查的 STRING 放到 WORD
    Word.AppShow
    Word.FileNew
    Word.Insert IncorrectText
        '运行 WORD 拼写检查
    Word.ToolsSpelling
    Word.EditSelectAll
        '取返回值
    retText = Word.Selection$()
    CheckSpell = Left$(retText, Len(retText) - 1)
        '关闭文件并回到 VB 应用
    Word.FileClose 2
    Show
        Set Word = Nothing
    End Function
      

  2.   

    Option Explicit
    Dim Doc As New Document
    Dim Visi As Boolean'拼写检查
    Private Sub Command1_Click()
        Form1.Caption = "拼写检查"
        Doc.Range.Text = Text1
        '确定范围
        Doc.Application.Visible = True              '将Word 97变为可见
        AppActivate Doc.Application.Caption
    '激活Word 97
        Call CheckSpell(Text1.Text)                     '拼写检查
        Text1 = Doc.Range.Text
        Text1 = Left(Text1, Len(Text1) - 1)
        AppActivate Caption
    End Sub'统计单词数
    Private Sub Command2_Click()
    Dim Dlg As Word.Dialog
        Doc.Range = Text1.Text
        Set Dlg = Doc.Application.Dialogs(wdDialogDocumentStatistics)
        Dlg.Execute                                 '统计单词和字符
    Form1.Caption = "单词数:" & Str(Dlg.Words) & "词" & Str(Dlg.Characters) & "字符"  '显示统计结果
    End SubPrivate Sub Form_Load()
         Form1.Caption = "调用Word 97"
         Text1.Text = ""
         Command1.Caption = "拼写检查"
         Command2.Caption = "统计单词"
         '使应用程序可见
         '‘Visi = Doc.Application.Visible
    End Sub'关闭应用程序
    Private Sub Form_Unload(Cancel As Integer)
    If Visi Then                    '关闭文件
        Doc.Close savechanges:=False
        Else
        Doc.Application.Quit savechanges:=False             '关闭 Word 97
         End If
    End SubFunction CheckSpell(IncorrectText As String) As String
    Dim Word As Object, retText$
    On Error Resume Next
    '建立对象并打开 WORD
    Set Word = CreateObject("Word.Basic")
        '把需要检查的 STRING 放到 WORD
    Word.AppShow
    Word.FileNew
    Word.Insert IncorrectText
        '运行 WORD 拼写检查
    Word.ToolsSpelling
    Word.EditSelectAll
        '取返回值
    retText = Word.Selection$()
    CheckSpell = Left$(retText, Len(retText) - 1)
        '关闭文件并回到 VB 应用
    Word.FileClose 2
    Show
        Set Word = Nothing
    End Function
      

  3.   

    dim WordApp as Word.Application
    dim WordDoc as Word.Documents
    set WordApp=new Word.Applicton
    wordapp.visible=true
    set worddoc=wordapp.document.add
      

  4.   

    用shell(“路径”)不就可以了