Opening a template document

T

T Ralya

I have a VB6 application that has been running under Windows XP using MS Word
97. We now want to move it to a server running Windows Server 2003 with
Office 2003. the code will create a new Word applicaiton and then attempt to
open a .dot document. The program terminates while in the ".Add" method.
Can anyone see anything wrong?

' ***** Create Word Document *****
Set objWordApp = New Word.Application
If objWordApp Is Nothing Then
TraceLog "Microsoft Word is not installed on this computer."
AssembleBrocert = False
Exit Function
End If

TraceLog "[modAssembly-AssembleBrocert] Word App Generated "

Select Case iDBType
Case cProdDatabase
sAssemblyDOTName = iniProdTextPath & "\WORD_DOT\gtb_hf.dot"
Case cDevelDatabase
sAssemblyDOTName = iniDevelTextPath & "\WORD_DOT\gtb_hf.dot"
End Select

TraceLog "[modAssembly-AssembleBrocert] Template " & sAssemblyDOTName &
" Selected."
Dim fso As FileSystemObject
Set fso = New FileSystemObject
If fso.FileExists(sAssemblyDOTName) Then
Dim objDoc As Word.Document
TraceLog "[modAssembly-AssembleBrocert] Verified existance of Template
" & Str(objWordApp.Documents.Count)

' Trace log shows that it gets here.
Set objDoc = objWordApp.Documents.Add(sAssemblyDOTName)

End If
' Trace log shows it did not get here.
TraceLog "[modAssembly-AssembleBrocert] Word Template Added "
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?VCBSYWx5YQ==?=,
91: - Object variable or with block variable not set
Are you still looking for help with this? My initial
reaction is that you might not have a valid reference to
the Word object library...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
T

T Ralya

I should have withdrawn my post. It turned out to result from the fact that
VB6 applications are not thread safe for execution on a server. At least
that is what Microsoft said. We ran the same application on Windows XP and
it was fine.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top