Jorge Ubeda


Hello all

Ií»m receiving an error -2147417851 when loading an html file to word: here is the code that generates such error:

Set rng = doc.ActiveWindow.Selection.Range
rng.InsertFile zzz.htm,, False

Some directions about where locate info about error codes

thaks in advance

Jorge Ubeda




Re: error -2147417851 working with VBA and Word

Andy Pope


Hi,

Which one of the 2 lines raises the error

Should the filename zzz.htm not be in quotes, other wise it will be treated as a object








Re: error -2147417851 working with VBA and Word

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






Re: error -2147417851 working with VBA and Word

Andy Pope

This article explains how to get a error message. Not sure it's relevant or helpful.
http://support.microsoft.com/kb/186063



Do the &(1) value include a full and accurate path description





Re: error -2147417851 working with VBA and Word

Jorge Ubeda

Yes, it is. I have tried both variants: with & without full paths (note that paths here are the server paths).

And, by the way, do you know what the error means





Re: error -2147417851 working with VBA and Word

Andy Pope

The error is as you might expect is vague and unhelpful.
 The server threw an exception






Re: error -2147417851 working with VBA and Word

Jorge Ubeda

Thanks Andy,

Better than nothing...