Jorge Ubeda
Thanks Andy, and apologies for responding lately...
Error continues. Being name with or without quotes, there are no changes.
Process happens in a complex environment: It is a Citrix server being called by a remote client. Processes occurs at server side; Word is configured at server side. It should be complex to determine where is the problem (C/S). But a great advise should be to know what #@! the -2147417851 error means. I have translated it to hex values, but I can¡¯t locate a corresponding error at all. I anyone knows where locate an error list for such vba erros, It should be great.
Error happens at the insertfile method. Here is the complete code (code embedded into a code generator, parameters passed as &(x). Parameters are well formed):
Dim Word
Dim doc
Dim marca
Dim rng
dim seguir
On error resume next
seguir = true
&(3) = ""
Set Word = CreateObject("Word.application")
if err.number <> 0 then
msgbox "Paso 1: " & err.description
&(3) = "ERR"
seguir = false
end if
if seguir = true then
Word.Visible = True
Set doc = Word.Documents.Add( &(2) & ".dot", False, , True)
if err.number <> 0 then
msgbox "Paso 2: " & err.description & " " & err.number
&(3) = "ERR"
seguir = false
end if
if seguir = true then
Set rng = doc.ActiveWindow.Selection.Range
rng.InsertFile &(1), , False
if err.number <> 0 then
msgbox "Paso 3: " & err.description & " " & err.number
&(3) = "ERR"
seguir = false
end if
end if
Set Word = Nothing
end if