Forum Discussion

  • bitsol's avatar
    bitsol
    Copper Contributor
    HI All
    bellow code I'm using but not getting the actual result from goto lab line move in end

    Sub URLPictureInsert()
    'Updateby Extendoffice 20161116
    'Update by Haytham 20180104

    Dim Pshp As Shape
    Dim xRg As Range
    Dim xCol As Long
    On Error Resume Next
    Application.ScreenUpdating = False
    Set Rng = ActiveSheet.Range("d2:d140")
    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 = 60
    .Height = 30
    .Top = xRg.Top + (xRg.Height - .Height) / 2
    .Left = xRg.Left + (xRg.Width - .Width) / 2
    End With
    lab:
    Set Pshp = Nothing
    Range("d2").Select
    Next
    Application.ScreenUpdating = True
    End Sub

  • Tpollock33's avatar
    Tpollock33
    Copper Contributor

    I know this is an older thread, but does anyone know how to change this VBA to populate the pictures in the cell below instead of to the right? 

  • Haytham Amairah's avatar
    Haytham Amairah
    Silver Contributor

    Hi Michael,

     

    No formula can help in this regard!

    You need a VBA code or a third-party add-in to view these images.

     

    Please check out this link.

     

    Hope that helps

    • MSDON25's avatar
      MSDON25
      Copper Contributor
      Hi Haytham,

      Is there a easy way to do this for a row instead of a column?

      ie. a range of image URLs from B2 to M2 and to show the image beneath it at C2 to M2?

      I'm not too familiar with VBA but couldn't get the VBA to work when I changed the columns to rows and rows to columns in the code.

      Thank you,
      Michael
      • EmielBin's avatar
        EmielBin
        Copper Contributor

        MSDON25  Don't know if this might help, but I found a video online that just used the 'image' function. And it worked just fine, if you are not too fuzzy on the dimensions of the image. I just made the rows a bit bigger so the logos show reasonably normal.

    • rsinghal2019's avatar
      rsinghal2019
      Copper Contributor

      Hi, I have a file having one column consist of many URLs and in next column I wish to convert these URLs into real images. I am using office 2007. Please find the file as attached. Kindly help me to convert this file . Looking forward.


      Haytham Amairah wrote:

      Hi Michael,

       

      No formula can help in this regard!

      You need a VBA code or a third-party add-in to view these images.

       

      Please check out this link.

       

      Hope that helps


      Haytham Amairah 

      • Haytham Amairah's avatar
        Haytham Amairah
        Silver Contributor

        Hi rsinghal2019,

         

        It seems that the links in the file aren't valid when you open them in the browser!

        Therefore, I don't think that the solution is applicable to them.

         

         

         

         

Resources