|
-
Oct 23rd, 2003, 05:49 PM
#1
Thread Starter
Member
- RESOLVED - How to add picture from web to Word doc
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.
Last edited by anti_you; Oct 24th, 2003 at 12:27 AM.
-
Oct 23rd, 2003, 07:21 PM
#2
Fanatic Member
I'm not sure why that doesn't work, but this should:
VB Code:
With Dialogs(wdDialogInsertPicture)
.Name = "http://www.google.ca/intl/en_ca/images/logo.gif"
.LinkToFile = False
.New = False
.FloatOverText = False
.Execute
End With
-
Oct 24th, 2003, 12:24 AM
#3
Thread Starter
Member
Thanks muchly WorkHorse!
That did the trick!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|