Results 1 to 2 of 2

Thread: Calling Word95/7 from VB6

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    1

    Post

    I'm writting an VB6 application which needs to open a Word Document from a Template. This I've managed with Word2000 installed using the following code...

    Dim WdApp As Word.Application
    Set WdApp = New Word.Application
    WdApp.Application.Visible = True
    WdApp.Documents.Add
    Template:=g_WordOrderFile$,
    NewTemplate:=False

    ... but it fails on the 'Set' line when using Word97 (Run Time Error 458 : Variable uses an Automation type not supportd in VB) or Word95 (Run Time Error 429 : Actice X component cant't be created)

    Can any one help me? ...... MTIA



  2. #2
    Guest

    Post

    Try this.

    Dim objWordApp As Object

    Set objWordApp = GetObject("", "Word.Application.8")
    If objWordApp Is Nothing Then
    Set objWordApp = CreateObject("Word.Application.8")
    End If

    objWordApp.Documents.Open FileName:="C:\MyWord.Doc"

    objWordApp.Documents(1).SaveAs "c:\Finish.Doc"
    objWordApp.Documents(1).Close
    objWordApp.Quit

    -Kayoca Mortation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width