|
-
Feb 15th, 2000, 08:54 PM
#1
Thread Starter
New Member
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
-
Feb 16th, 2000, 12:17 PM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|