+ Reply to Thread
Results 1 to 3 of 3

Help with code downloading photos into excel from URL

Hybrid View

  1. #1
    Registered User
    Join Date
    05-15-2019
    Location
    Hawaii
    MS-Off Ver
    Excel 2016
    Posts
    2

    Help with code downloading photos into excel from URL

    Hi,
    I was able to use the code below to import photos into excel spread sheet using the link but I was wondering if anyone can help me figure out a code to put the photos in the corresponding hyperlink box
    so if hyperlink is in A1 can I get the image to go into B1? Also I just realized this is not downloading the photos. Is there a way to actually download them?
    Sub URLPictureInsert()
    'Updateby Extendoffice 20161116
        Dim Pshp As Shape
        Dim xRg As Range
        Dim xCol As Long
        On Error Resume Next
        Application.ScreenUpdating = False
        Set Rng = ActiveSheet.Range("A2:A781")
        For Each cell In Rng
            filenam = cell
            ActiveSheet.Pictures.Insert(filenam).Select
            Set Pshp = Selection.ShapeRange.Item(1)
            If Pshp Is Nothing Then GoTo lab
            xCol = cell.Column + 1
            Set xRg = Cells(cell.Row, xCol)
            With Pshp
                .LockAspectRatio = msoFalse
                .Width = 100
               .Height = 100
                .Top = xRg.Top + (xRg.Height - .Height) / 2
                .Left = xRg.Left + (xRg.Width - .Width) / 2
            End With
    lab:
        Set Pshp = Nothing
        Range("A2").Select
        Next
        Application.ScreenUpdating = True
    End Sub
    Last edited by makadangdang; 05-15-2019 at 05:31 PM. Reason: realized images are there but not downloaded

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Help with code downloading photos into excel from URL

    Hi, welcome to the forum.
    You should lookup post by MyVB_polly and anilpatni1234; they've got some files with code inserting pictures in a cell's worksheet , I'm sure it'll help you one way or another
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    05-15-2019
    Location
    Hawaii
    MS-Off Ver
    Excel 2016
    Posts
    2

    Re: Help with code downloading photos into excel from URL

    Thank you I will check that out

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Code to insert photos not working.
    By moonbreakker in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-03-2018, 01:31 AM
  2. Code for downloading images from URL list
    By Ozwilly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2017, 12:29 AM
  3. Replies: 9
    Last Post: 12-23-2016, 10:54 PM
  4. Replies: 3
    Last Post: 03-02-2016, 06:47 PM
  5. VBA Code to insert photos and filenames
    By timbaliyah in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-05-2015, 03:58 AM
  6. New code keeps shifting photos up when updating old photo
    By atomichybrid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2015, 06:33 PM
  7. VBA Insert all Photos from folder - photos not lined up w/ cell borders in older versions
    By jaimelwilson in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-10-2014, 02:26 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1