G
Guest
Hi,
I'm wondering whether anyone can help with this.
I have a function that accepts the name of a word template, strTemplate and
opens a word document based on this template. The following is the part of
the code which is failing. When the function is called, a Word window is
created but no new word document is created. This function works perfectly
on two computers but I can't get it to work at all on a third computer. I
suspect it is a references problem but can't seem to fix this so I'm
wondering if I am barking up the wrong tree. The two MsgBox statements
below produce the error description "ActiveX Component can't create object".
Thank you in advance.
Dim WordObj1 As Word.Application
Dim WordDoc As Word.Document
Set dbDatabase1 = CurrentDb()
strPath = Form_frm_NSWGS!LetterTemplatePath
Set WordObj1 = GetObject(, "word.application")
MsgBox (Err.Description)
If Err.Number <> 0 Then
Set WordObj1 = CreateObject("word.application")
MsgBox (Err.Description)
End If
WordObj1.Visible = True
WordObj1.Documents.Add Template:=strPath & strTemplate & ".dot",
NewTemplate:=False
I'm wondering whether anyone can help with this.
I have a function that accepts the name of a word template, strTemplate and
opens a word document based on this template. The following is the part of
the code which is failing. When the function is called, a Word window is
created but no new word document is created. This function works perfectly
on two computers but I can't get it to work at all on a third computer. I
suspect it is a references problem but can't seem to fix this so I'm
wondering if I am barking up the wrong tree. The two MsgBox statements
below produce the error description "ActiveX Component can't create object".
Thank you in advance.
Dim WordObj1 As Word.Application
Dim WordDoc As Word.Document
Set dbDatabase1 = CurrentDb()
strPath = Form_frm_NSWGS!LetterTemplatePath
Set WordObj1 = GetObject(, "word.application")
MsgBox (Err.Description)
If Err.Number <> 0 Then
Set WordObj1 = CreateObject("word.application")
MsgBox (Err.Description)
End If
WordObj1.Visible = True
WordObj1.Documents.Add Template:=strPath & strTemplate & ".dot",
NewTemplate:=False