INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Excel 2010 - resolve image from URL in cell

Excel 2010 - resolve image from URL in cell

(OP)
Hi, i am looking for some VBA code to resolve an url image name in CELL A1 to A1000 and place the image in a new cell next to it. If the image does not exist then no image is displayed.

This is what i have so far..

CODE

Sub Test()
    Dim objPicture As Picture
For i = 2 To 100
        With Sheet1.Cells(i, 9)
        Set objPicture = .Parent.Pictures.Insert(Sheet1.Cells(i, 1).Value)
        objPicture.Top = .Top
        objPicture.Left = .Left
        objPicture.Height = 150
        objPicture.Width = 150
    End With
    Next i
End Sub 

Please can anyone help?

Many thanks

Brian

RE: Excel 2010 - resolve image from URL in cell

HI,

Well what happens when you run your code? Please be very specific.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Excel 2010 - resolve image from URL in cell

This might work...

CODE

Sub Test()
    Dim i As Long
    For i = 2 To 100
        Sheet1.Pictures(i - 1).Copy
        Sheet1.Cells(i, 9).PasteSpecial xlPasteAll
        With Sheet1.Pictures(Sheet1.Pictures.Count)
            .Top = .TopLeftCell.Top
            .Left = .TopLeftCell.Left
            .Height = 150
            .Width = 150
       End With
    Next i
End Sub 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Excel 2010 - resolve image from URL in cell

This utility function I've just put together might help:

CODE

Public Function GetUrlPic(srcUrlcell As Range, targetcell As Range) As String
    On Error GoTo Skip
    With targetcell.Parent.Shapes.AddPicture(srcUrlcell, True, True, targetcell.Left, targetcell.Top, 70, 70)
        .LockAspectRatio = msoTrue
        .ScaleWidth 1, msoTrue, msoScaleFromTopLeft
    End With
Skip:
    On Error GoTo 0
End Function 

RE: Excel 2010 - resolve image from URL in cell

Did either of these suggestions help?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close