anti_you
Oct 23rd, 2003, 05:49 PM
Is it possible to get Word VBA to insert a picture from a web page? I've tried the following using AddPicture method:
ActiveDocument.Shapes.AddPicture Anchor:=Selection.Range, FileName:= _
"http://www.google.ca/intl/en_ca/images/logo.gif", _
LinkToFile:=False, SaveWithDocument:=True
(as a test, loading the Google logo)
The above code is as generated by Macro record -which it gladly accepts as a valid filename.
When the macro is run however, it returns a 'Run-time error 5152 -This is not a valid filename.'
Yet if I use the Word menus: Insert, Picture, From File and enter a web addressed picture in the Filename box it finds and loads it into the Word doc without a problem. What gives? Is there another method for doing this?
Thanks.
ActiveDocument.Shapes.AddPicture Anchor:=Selection.Range, FileName:= _
"http://www.google.ca/intl/en_ca/images/logo.gif", _
LinkToFile:=False, SaveWithDocument:=True
(as a test, loading the Google logo)
The above code is as generated by Macro record -which it gladly accepts as a valid filename.
When the macro is run however, it returns a 'Run-time error 5152 -This is not a valid filename.'
Yet if I use the Word menus: Insert, Picture, From File and enter a web addressed picture in the Filename box it finds and loads it into the Word doc without a problem. What gives? Is there another method for doing this?
Thanks.