views:

104

answers:

1

Hello, from Automation in jscript how can I programatically insert an image into Word (2000+) from a URL?

The url also is quite long, around 400 characters, and I've read that Word 2007 has a problem sometimes with strings longer than 255 characters.

I've used this successfully except that it won't allow urls longer than 255 characters:

    var oDialog = oWordDoc.Application.Dialogs( wdDialogInsertPicture );
    oDialog.Name = imageUrl;
    oDialog.LinkToFile = false;
    oDialog.FloatOverText = true;
    oDialog.Execute();
+1  A: 

I don't have a > 255 char url to test it with, but try this:

oWordDoc.Shapes.AddPicture(imageUrl, false);
Foole
Great that works. My remaining problem is that now the image comes out of my table cell it was in. I was using oDialog.FloatOverText = true; before to stop this. Do you know what the equivalent Shapes parameter is?
Matthew Lock
It should be floating over text by default. Maybe it is just anchored to the wrong part of the document? A "Shape" is floating and an "InlineShape" is not. Both classes have "ConvertTox" functions to convert to the other.
Foole