Dim oWord As Word.Application
    
    Set oWord = CreateObject("Word.Application")
    oWord.Documents.Open FileName:="c:\test.doc"
    oWord.Visible = True
    Set oWord = Nothing
引用word application X.0

解决方案 »

  1.   

    这样就启动了我本机的WORD程序,我要的是在程序窗体里显示WORD文件
      

  2.   

    我就是想将WORD文件发布在网页上的啊,如果直接用IE打开将不能控制打印,另存等功能啊,
      

  3.   

    一个很轻量级的OCX,叫做OfficeViewer的东西,可以达到你的目的。它几乎可以用来看所有的Office文件。
    如果你的机器上没有,我告诉你到哪里下:
    在MS的站上随便找一个DOC文件的链接,下面一个链接就是OfficeViewer。
    分来。
      

  4.   

    但是我是要在自已的程序里显示WORD啊,他又不带控件,没有什么意义啊
      

  5.   

    用RichTextBox控件:
    具体代码见下:
    public sub OpenFile(byval strWordFile as string)
    Dim m_strTmpRtfFile As String
    Dim objWord As Object
    Dim objWordDocument As Word.Document
    Const CLASSOBJECT = "Word.Application"
    If (objWord Is Nothing) Then
       Set objWord = CreateObject(CLASSOBJECT)
    End If
    m_strTmpRtfFile = app.path & "\tmp.rtf"
    Set objWordDocument = objWord.Documents.Open FileName:=strWordFile)
    objWord.Visible = False
    objWord.PrintOut FileName:=strWordFile              '打印word
    objWordDocument.SaveAs m_strTmpRtfFile, wdFormatRTF '另存为RTF格式
    Set objWordDocument = Nothing
    objWord.Quit SaveChanges:=wdDoNotSaveChanges                        '退出Word
    Set objWord = Nothing
    if dir(m_strTmpRtfFile)<>"" then
       RichTextBox1.LoadFile m_strTmpRtfFile              '显示word
    end if
    end sub
      

  6.   

    存为RTF我的很多表格格式都丢掉了,好象。主要是表格比较复杂才选择用WORD的
      

  7.   

    还是OLE里加如WORD比较好,还可以进行编辑,其实就是调用 WORD
      

  8.   

    可是我想做成控件就不能用OLE了
      

  9.   

    使用RichTextBox控件自己做空间!!
      

  10.   

    为什么都喜欢用richtextbox呢?
      

  11.   

    richtextbox支持现有的word格式吗?
    好像还要先把word文档转成rtf格式?
      

  12.   

    不行啊,后来还是不能做到自已的控件中去,试过RICHTEXTBOX会丢失一些表格信息等。