我在VB 程序中使用以下代码可以打开WORD 程序 并把 指定字符串显示在WORD 中
请问怎么样用同样方法打开指定路径的文件。
我主要是对WORD 对象的属性方法不熟悉,请问大家哪里有这方面帮助?
    Dim objWord As Object
   Set objWord = CreateObject("Word.Application")
    objWord.Visible = True
    '在Word中添加文本。
    objWord.Documents.Add
        '设置文本属性。
    With objWord
        .ActiveDocument.Paragraphs(1).Range.Bold = False
        .ActiveDocument.Paragraphs(1).Range.Font.Size = 30
        .ActiveDocument.Paragraphs(1).Range.Font.Name = "黑体"
        .ActiveDocument.Paragraphs(1).Range.Font.ColorIndex = 6
        .ActiveDocument.Paragraphs(1).Range.Text = "照猫画虎给你惊叹!"
        
    End With
    'objWord.PrintPreview = True '打印预览方式。
    objWord.PrintOut '打印文本。

解决方案 »

  1.   

    Dim objWord As Object
        Set objWord = CreateObject("Word.Application")
        objWord.Visible = True
        objWord.Documents.Open ("f:\test.doc")
        MsgBox "open finished,now close!"
        objWord.Quit
        Set obword = Nothing
      

  2.   

    Dim WordTemps As New Word.Application '定义WORD类
        WordTemps.Documents.Add App.Path + "\测试文档.dot", False
        WordTemps.visible=true