Error 5121 - Cant open template via Active X

T

Toby Mills

Hi all,
I'm having a bit of a prob with Office 2K when trying to open a word
template via activeX.
If i pass a URL of a word template location to the word application to open
it returns the error 5121, cant find the document. If i pass the same url to
the application but specify it as a word document it works. Also if i use
the word.documents.add to open the template it has the same prob.

I know this is not a VBA App but thought you masters may be able to help out
with this.
Any ideas?

The problem doesn't seem to occur in office xp or 2003.

My code is as follows ...
Sub LoadWordDoc(docURL)
ON ERROR RESUME NEXT
Set Word = CreateObject("Word.Application")
Word.Visible = True
FileName = docURL
ConfirmConversions = False
DocReadOnly = False
AddToRecentFiles = False
PasswordDocument = ""
PasswordTemplate = ""
Revert = false
WritePasswordDocument = ""
WritePasswordTemplate = ""
wdOpenFormatTemplate = 2 '= wordDocumentTemplate type
'if i use wdOpenFormatAuto then it fine but does not open it as a
template but in edit mode
Encoding = null
Visible = True

'call Word.Documents.Add (docURL, false, false, false)
call Word.Documents.open(FileName, ConfirmConversions, DocReadOnly,
AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert,
WritePasswordDocument, WritePasswordTemplate, wdOpenFormatTemplate,
Encoding, Visible)
IF err then alert err.number & vbcrlf & err.description
End Sub

Many thanks

T
 

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