Note: The other languages of the website are Google-translated. Back to English
Увійти  \/ 
x
or
x
Реєстрація  \/ 
x

or

Як перетворити URL-адреси зображень на фактичні зображення в Excel?

doc url img 1

Якщо у вас є список адрес URL-адрес зображень у стовпці A і зараз, ви хочете завантажити відповідні картинки із URL-адрес і відобразити їх у сусідньому стовпці B, як показано на лівому скріншоті. Як в Excel можна швидко та легко витягувати фактичні зображення із URL-адрес зображень?

Перетворіть URL-адреси зображень у фактичні зображення за допомогою коду VBA

Перетворіть URL-адреси зображень на фактичні зображення за допомогою Kutools для Excel


Перетворіть URL-адреси зображень у фактичні зображення за допомогою коду VBA

Наступний код VBA може допомогти вам швидко витягнути фактичні зображення з URL-адрес зображення, будь ласка, зробіть так:

1. Утримуйте клавішу ALT + F11 клавіші, щоб відкрити вікно Microsoft Visual Basic for Applications.

2. Клацання Insert > Модуліта вставте наступний код у вікно модуля.

Код VBA: Перетворення URL-адрес зображень у фактичні зображення:

Sub URLPictureInsert()
Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
Set Rng = ActiveSheet.Range("A2:A5")
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
If .Width > xRg.Width Then .Width = xRg.Width * 2 / 3
If .Height > xRg.Height Then .Height = xRg.Height * 2 / 3
.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

Примітки: 

  • 1. У наведеному вище коді A2: A5 - це діапазон комірок, який містить URL-адреси, які ви хочете витягти із зображень, вам слід змінити посилання на комірки відповідно до ваших потреб.
  • 2. За допомогою цього коду ви не можете вказати розмір витягнутих зображень відповідно до ваших потреб.
  • 3. Зазначений вище код може лише витягти фактичні зображення в комірки, крім стовпця URL-адреси, ви не можете вказати комірку для виведення зображень.
  • 4. Ви повинні мати деякі базові знання коду, якщо будь-який символ пропущений або неправильний, код не буде виконаний успішно.

3. Потім натисніть F5 клавішу для запуску цього коду, і всі відповідні картинки були витягнуті з URL-адрес зображення відразу до сусіднього стовпця, і зображення будуть розміщені в центрі конкретних комірок, див. знімок екрана:

doc url img 2


Перетворіть URL-адреси зображень на фактичні зображення за допомогою Kutools для Excel

Якщо ви не знайомі з кодом VBA або хочете виправити обмеження вищевказаного коду, Kutools для Excel's Вставити зображення у форму Шлях (URL) Ця функція може допомогти вам швидко вставити відповідні зображення на основі URL-адрес або конкретного шляху у ваш комп’ютер, як показано нижче. Клацніть, щоб завантажити Kutools для Excel!

примітки:Щоб застосувати це Вставити зображення у форму Шлях (URL), по-перше, вам слід завантажити Kutools для Excel, а потім швидко та легко застосувати функцію.

після установки Kutools для Excel, будь ласка, зробіть так:

1. Клацання Кутулс > Insert > Вставити зображення у форму Шлях (URL), у спливаючому діалоговому вікні встановіть наступні операції, див. скріншоти:

doc url img 3 doc url img 4

2. Потім натисніть кнопку Ok , і зображення будуть витягнуті з URL-адрес, див. знімок екрана:

doc url img 1

Клацніть, щоб завантажити та отримати безкоштовну пробну версію Kutools для Excel зараз!


Найкращі інструменти для підвищення продуктивності офісу

Kutools для Excel вирішує більшість ваших проблем і збільшує продуктивність на 80%

  • Повторне використання: Швидко вставте складні формули, діаграми і все, що ви використовували раніше; Шифрувати комірки з паролем; Створити список розсилки та надсилати електронні листи ...
  • Супер формула бар (легко редагувати кілька рядків тексту та формули); Макет читання (легко читати та редагувати велику кількість комірок); Вставте у відфільтрований діапазон...
  • Об’єднати клітинки / рядки / стовпці без втрати даних; Вміст розділених комірок; Об'єднати повторювані рядки / стовпці... Запобігання дублюючим клітинам; Порівняйте діапазони...
  • Виберіть Повторюваний або Унікальний Рядки; Виберіть Пусті рядки (усі клітинки порожні); Супер знахідка та нечітка знахідка у багатьох робочих зошитах; Випадковий вибір ...
  • Точна копія Кілька клітинок без зміни посилання на формулу; Автоматичне створення посилань на кілька аркушів; Вставте кулі, Прапорці та інше ...
  • Витяг тексту, Додати текст, Видалити за позицією, Видаліть пробіл; Створення та друк проміжних підсумків підкачки; Перетворення вмісту комірок та коментарів...
  • Супер фільтр (зберегти та застосувати схеми фільтрів до інших аркушів); Розширене сортування за місяцем / тижнем / днем, частотою та іншим; Спеціальний фільтр жирним, курсивом ...
  • Поєднайте робочі зошити та робочі аркуші; Об’єднати таблиці на основі ключових стовпців; Розділіть дані на кілька аркушів; Пакетне перетворення xls, xlsx та PDF...
  • Понад 300 потужних функцій. Підтримує Office / Excel 2007-2019 та 365. Підтримує всі мови. Простота розгортання на вашому підприємстві чи в організації. Повна функція 30-денної безкоштовної пробної версії. 60-денна гарантія повернення грошей.
вкладка kte 201905

Вкладка Office забезпечує інтерфейс з вкладками для Office і значно спрощує вашу роботу

  • Увімкніть редагування та читання на вкладках у Word, Excel, PowerPoint, Publisher, Access, Visio та Project.
  • Відкривайте та створюйте кілька документів на нових вкладках того самого вікна, а не в нових вікнах.
  • Збільшує вашу продуктивність на 50% та зменшує сотні клацань миші для вас щодня!
дно офісної таблиці
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Phbronson · 2 months ago
    I own Kutools and I cannot seem to get this function to work properly. After I run it based on the examples above I get a message that says "1 picture(s) failed to be inserted"

    Its not an htpps address. And the link the works fine when clicking from excel. 

    Please help
    • To post as a guest, your comment is unpublished.
      Maike · 1 months ago
      I have the same problem now. It worked very well yesterday, but today it's just not working :(
  • To post as a guest, your comment is unpublished.
    Mike · 5 months ago
    If I want the image to resize with the cell, is it as simple as changing this line to "msoTrue"?
    .LockAspectRatio = msoFalse


  • To post as a guest, your comment is unpublished.
    sekhil · 8 months ago
    When I renew it takes the same picture again
    So it adds images on top of each other
    how can i prevent this?
    Do not add the added picture again ?how can I do?

    edit: also pictures are not loading when we open later?
  • To post as a guest, your comment is unpublished.
    efecan · 8 months ago
    When I renew it takes the same picture again
    So it adds images on top of each other
    how can i prevent this?
    Do not add the added picture again ?how can I do?
  • To post as a guest, your comment is unpublished.
    Robby · 9 months ago
    thank you for VBA code, i able to get the url images as picture
    but, after file closed, and then i opened it again, picture missing.
    how to solve this problem?
    • To post as a guest, your comment is unpublished.
      skyyang · 9 months ago
      Hello, Robby,
      After copying and pasting the code, when you close the workbook, you should save the file as Excel Macro-Enabled Workbook format for saving the code.
      When reopen the workbook, you should click the Enable Content button from the yellow ribbon at the top of the workbook.
      Please try, thank you!
      • To post as a guest, your comment is unpublished.
        Robby · 9 months ago
        thank you for fast response
        I have save as Excel Enable Workbook and also Enable Content, and Picture will be shown up if i connected to internet, but when offline mode, the picture will be missing, Excel message : Picture can't be display
        is there any solution so the picture will still shown up even though i am in offline mode (no internet available)
        • To post as a guest, your comment is unpublished.
          skyyang · 9 months ago
          Hi, Robby,
          In this case, if you are in offline mode, I recommend you to use the Insert Pictures form Path(URL) feature of Kutools for Excel, you can download the Kutools and use it 30 days for free trail. After inserting the pictures, the pictures will be saved into the workbook.
          Please try.
  • To post as a guest, your comment is unpublished.
    travwoody · 9 months ago
    What image types does this work with? I have mostly svg files and those are not working, but png and jpeg are fine.
    • To post as a guest, your comment is unpublished.
      skyyang · 9 months ago
      Hello, travwoody,
      Yes, as you said, the code does not work for the svg files.
      Or can you insert a picture url here? We can test your image url for modifying the code.
      Thank you!
  • To post as a guest, your comment is unpublished.
    Sankar Sengupta · 9 months ago
    Why this line is not working for me?
    Set Pshp = Selection.ShapeRange.Item(1)
    Pshp object is becoming nothing, even though I have a valid image URL

  • To post as a guest, your comment is unpublished.
    Andrej · 1 years ago
    I will also specify that I am writing about the VBA script
  • To post as a guest, your comment is unpublished.
    SY · 1 years ago
    This code works great. Thank you!

  • To post as a guest, your comment is unpublished.
    Jaffe · 1 years ago
    Hi, The function for importing images from "Insert Pictures form Path(URL)" isn't there where you say it should. Where can I find that function?
    • To post as a guest, your comment is unpublished.
      skyyang · 1 years ago
      Hi, Jaffe,
      Could you explain your problem clearly or the code does not work for you?
      Thank you!
  • To post as a guest, your comment is unpublished.
    Oscar · 2 years ago
    Kutools no importa las imagenes alojadas en Drive. Como hago?
  • To post as a guest, your comment is unpublished.
    Ronnie · 2 years ago
    hey! with the Help of the Vba Code the Image has been extracted to the sheet but as i am moving my workbooks location the Image are Corrupted so help me here
  • To post as a guest, your comment is unpublished.
    karim · 2 years ago
    working perfect
    thanks a lot
  • To post as a guest, your comment is unpublished.
    Jo · 2 years ago
    if the url is in https, for sure there is no way to work around it?
  • To post as a guest, your comment is unpublished.
    karthik.bluestake1@gmail.com · 2 years ago
    Hello I'm here asking for your help. My research ended up in 2 different macros that combined will give a good utility for my work.
    1. Will insert image as comment, 2. Will fetch Hyperlinks(Local folder path only, not web based URL) and paste them in destination cell
    I really tried to combine them to do one job, but I guess I don’t have enough knowledge on this.
    I need the images to be inserted as comment as the 1st code does to the destination range user selects.

    Sub InsertPictureAsComment()
    Dim PicturePath As String
    Dim CommentBox As Comment
    With Application.FileDialog(msoFileDialogFilePicker)
    .AllowMultiSelect = True
    .title = "Select Comment Image"
    .ButtonName = "Insert Image"
    .Filters.clear
    .Filters.Add "Images", "*.png; *.jpg"
    .Show
    'Store Selected File Path
    On Error GoTo UserCancelled
    PicturePath = .SelectedItems(1)
    On Error GoTo 0
    End With
    'Clear Any Existing Comment
    Application.ActiveCell.ClearComments
    'Create a New Cell Comment
    Set CommentBox = Application.ActiveCell.AddComment
    'Remove Any Default Comment Text
    CommentBox.Text Text:=""
    'Insert The Image and Resize
    CommentBox.Shape.Fill.UserPicture (PicturePath)
    CommentBox.Shape.ScaleHeight 6, msoFalse, msoScaleFormTopLeft
    CommentBox.Shape.ScaleWidth 4.8, msoFalse, msoScaleFromTopLeft
    'Ensure Comment is Hidden (Swith to TRUE if you want visible)
    CommentBox.Visible = False
    Exit Sub
    'ERROR HANDLERS
    UserCancelled:
    MsgBox "Done"
    End Sub

    Sub URLToCellPictureInsert()
    'Updateby Extendoffice 20180608
    Dim Pshp As Shape
    Dim xRg As Range
    Dim xCol As Long
    On Error Resume Next
    Set Rng = Application.InputBox("Please select the url cells:", "KuTools for excel", Selection.Address, , , , , 8)
    If Rng Is Nothing Then Exit Sub
    Set xRg = Application.InputBox("Please select a cell to put the image as comment:", "KuTools for excel", , , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    For i = 1 To Rng.Count
    filenam = Rng(i)
    ActiveSheet.Pictures.Insert(filenam).Select
    Set Pshp = Selection.ShapeRange.Item(1)
    If Pshp Is Nothing Then GoTo lab
    xCol = cell.Column + 1
    Set xRg = xRg.Offset(i - 1, 0)
    With Pshp
    .LockAspectRatio = msoFalse
    .Width = 80
    .Height = 80
    .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
    • To post as a guest, your comment is unpublished.
      Sharath · 2 years ago
      Before first End Sub Call the Module URLToCellPictureInsert and remove the msgbox Done paste before 2nd End sub

      Like this: Call URLToCellPictureInsert
  • To post as a guest, your comment is unpublished.
    Chile · 3 years ago
    Hello

    I try to get 33 images from URL but only gives me 1, all URL paths to the images are correct... what can that be?
  • To post as a guest, your comment is unpublished.
    Justyna · 3 years ago
    Hi,

    I have pictures with different resolutions. What should I write in height and width to keep the proportion of images?
    • To post as a guest, your comment is unpublished.
      skyyang · 3 years ago
      Hello, Justyna,
      May be there is no other good way to keep the proportion of images if the pictures with different resolutions.
      If you have the good solution, please comment here, thank you!
  • To post as a guest, your comment is unpublished.
    Ed · 3 years ago
    Hi all, This Macro is great. However, it does not really add pictures to the file but links that generate pictures each time I open the file. Thus I cannot compress pictures as they are not really inside the file. Could you please help me to really save pictures inside the file?
    • To post as a guest, your comment is unpublished.
      enrico rinero · 2 years ago
      Hi! I have the same question.
      There is a way to save the image effectively in the excel? (and not linked outside)
  • To post as a guest, your comment is unpublished.
    Shozib · 3 years ago
    Hi skyyang, first for such an informative post. I have a question, could you please help me. Using this code of your's I want to extract just one pic and want to place it in a specific cell. Is it possible??
    • To post as a guest, your comment is unpublished.
      skyyang · 3 years ago
      Hello, Shozib,
      To put the images to any other cells as you want, please apply the following VBA code:

      Sub URLPictureInsert1()
      'Updateby Extendoffice 20180608
      Dim Pshp As Shape
      Dim xRg As Range
      Dim xCol As Long
      On Error Resume Next
      Set Rng = Application.InputBox("Please select the url cells:", "KuTools for excel", Selection.Address, , , , , 8)
      If Rng Is Nothing Then Exit Sub
      Set xRg = Application.InputBox("Please select a cell to put the image:", "KuTools for excel", , , , , , 8)
      If xRg Is Nothing Then Exit Sub
      Application.ScreenUpdating = False
      For I = 1 To Rng.Count
      filenam = Rng(I)
      ActiveSheet.Pictures.Insert(filenam).Select
      Set Pshp = Selection.ShapeRange.Item(1)
      If Pshp Is Nothing Then GoTo lab
      xCol = cell.Column + 1
      Set xRg = xRg.Offset(I - 1, 0)
      With Pshp
      .LockAspectRatio = msoFalse
      .Width = 80
      .Height = 80
      .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

      Please try it, hope it can help you!
  • To post as a guest, your comment is unpublished.
    SamR · 3 years ago
    I'm using an Intel I5 processor, windows 7 professional 64bit, Office 2016 64 bit. I assume that the problem is a setting in Excel. Any help would be greatly appreciated.
    range is set, filenam = url and changes with each pass, Pshp is always nothing, URL's are verified, Any Ideas
  • To post as a guest, your comment is unpublished.
    SamR · 3 years ago
    range is set, filenam = url and changes with each pass, Pshp is always nothing. Any Ideas
  • To post as a guest, your comment is unpublished.
    Zafar Khan · 3 years ago
    Thanks for your post. How I can get the pictures in the center of the cell. With the current codes the pictures are showing in the top left corner
    • To post as a guest, your comment is unpublished.
      skyyang · 3 years ago
      Hello, Khan,
      the following VBA code can help you to extract the picture and put them into the center of the cells, please try it.

      Sub URLPictureInsert()
      Dim Pshp As Shape
      Dim xRg As Range
      Dim xCol As Long
      On Error Resume Next
      Application.ScreenUpdating = False
      Set Rng = ActiveSheet.Range("A2:A6")
      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
      If .Width > xRg.Width Then .Width = xRg.Width * 2 / 3
      If .Height > xRg.Height Then .Height = xRg.Height * 2 / 3
      .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
      • To post as a guest, your comment is unpublished.
        vipin.sahu4390@gmail.com · 3 years ago
        Hello,
        I want to download the images from the URL's (Column A) in a specific folder and rename the same images with a code/number which is there in Column B.
        • To post as a guest, your comment is unpublished.
          skyyang · 3 years ago
          Hello, Vipin,
          To save the URL'S images into a folder and rename them with the new names in Column B, may be the following VBA code can help you:

          Note: Column A contains the URL addresses and Column B has the new names.

          #If VBA7 Then
          Private Declare PtrSafe Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
          #Else
          Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
          #End If
          Sub URLPictureInsert()
          Dim I As Integer
          Dim xStr As String
          Dim xFd As FileDialog
          Dim xArr, xFdItem As Variant
          Application.ScreenUpdating = False
          Set xFd = Application.FileDialog(msoFileDialogFolderPicker)
          If xFd.Show = -1 Then
          xFdItem = xFd.SelectedItems.Item(1)
          xArr = Range("A2:B5").Value
          For I = 1 To UBound(xArr)
          If xArr(I, 1) <> "" Then
          xStr = Mid(xArr(I, 1), InStrRev(xArr(I, 1), "."), Len(xArr(I, 1)))
          URLDownloadToFile 0, xArr(I, 1), xFdItem & "\" & xArr(I, 2) & I & xStr, 0, 0
          End If
          Next
          End If
          Application.ScreenUpdating = True
          End Sub

          Please try it, hope this can help you!
          • To post as a guest, your comment is unpublished.
            David · 2 years ago
            the renaming part on column B uploads into the folder but is adding a number count next to the name of the picture, how I can omit that?

            Thank you
            • To post as a guest, your comment is unpublished.
              skyyang · 2 years ago
              Hi, David,
              May be the below vba code can help you to extract the iimages and rename them wihtout the subfix number, please try. Hope it can help you!

              #If VBA7 Then
              Private Declare PtrSafe Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
              #Else
              Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
              #End If
              Sub URLPictureInsert()
              Dim I As Integer
              Dim xStr As String
              Dim xFd As FileDialog
              Dim xArr, xFdItem As Variant
              Application.ScreenUpdating = False
              Set xFd = Application.FileDialog(msoFileDialogFolderPicker)
              If xFd.Show = -1 Then
              xFdItem = xFd.SelectedItems.Item(1)
              xArr = Range("A2:B5").Value
              For I = 1 To UBound(xArr)
              If xArr(I, 1) <> "" Then
              xStr = Mid(xArr(I, 1), InStrRev(xArr(I, 1), "."), Len(xArr(I, 1)))
              URLDownloadToFile 0, xArr(I, 1), xFdItem & "\" & xArr(I, 2) & xStr, 0, 0
              End If
              Next
              End If
              Application.ScreenUpdating = True
              End Sub
              • To post as a guest, your comment is unpublished.
                david · 2 years ago
                Omg!! You just provided a miracle, It works like a charm. Thank you so much.
      • To post as a guest, your comment is unpublished.
        Justin · 3 years ago
        Couldn't get this to work can you show the completed code for this request?
  • To post as a guest, your comment is unpublished.
    DKcrm · 3 years ago
    Works great for pulling images, but they are put randomly and not in the expected cells... Excel 2016 from Office365...
    • To post as a guest, your comment is unpublished.
      skyyang · 3 years ago
      Hello, DKcrm,
      Thank you for your comment, the code in this article has been updated, please try the new one, hope it can help you!
  • To post as a guest, your comment is unpublished.
    Iris De Smedt · 4 years ago
    Hi guys,
    It would love to get this working but when I copy this in VBA & click on run I only get this text:
    Sub URLPictureInsert()
    Can you please help me to get the picture thumbnail?
    • To post as a guest, your comment is unpublished.
      skyyang · 3 years ago
      Hello,
      When applying the code, you can change the width and height size of the picture to match you cells.
      Thank you!
  • To post as a guest, your comment is unpublished.
    Taylor Hays · 4 years ago
    Is there any way to run this so that it is across a row instead of a column? I have tried simply changing the range and the final location of the image but it only ever produces the first cell.
    • To post as a guest, your comment is unpublished.
      skyyang · 4 years ago
      Hi, Taylor,
      May be the following VBA code can help you to extract the real pictures in a row URLs:


      Sub URLPictureInsert()
      Dim Pshp As Shape
      On Error Resume Next
      Application.ScreenUpdating = False
      Set Rng = ActiveSheet.Range("A1:E1")
      For Each cell In Rng
      filenam = cell
      ActiveSheet.Pictures.Insert(filenam).Select
      Set Pshp = Selection.ShapeRange.Item(1)
      With Pshp
      .LockAspectRatio = msoTrue
      .Width = 100
      .Height = 100
      .Cut
      End With
      Cells(cell.Row + 1, cell.Column).PasteSpecial
      Next
      Application.ScreenUpdating = True
      End Sub

      Please try it, hope it can help you. Thank you!
  • To post as a guest, your comment is unpublished.
    bfrbouch · 4 years ago
    To get this to work in Excel 2010 I had to add these declarations.


    Dim Rng As Range
    Dim cell As Range
    Dim filenam As String
  • To post as a guest, your comment is unpublished.
    Mark · 4 years ago
    In Excel 2010 I had to add these declarations

    Dim Rng As Range
    Dim cell As Range
    Dim filenam As String
  • To post as a guest, your comment is unpublished.
    Florent · 4 years ago
    Works perfectly but can anyone help me add something to check if the image exists and if it doesn't, post a text in the cell like "Image unavailable" ??
  • To post as a guest, your comment is unpublished.
    Jeremy · 4 years ago
    For me, all that shows up in each cell is the name of the method. They all say "Sub URLPictureInsert()"
  • To post as a guest, your comment is unpublished.
    belliney · 4 years ago
    AMAZING! this is so great! i had 350 rows of hyperlink and it took only 5 mins to pull all images!
    • To post as a guest, your comment is unpublished.
      Naresh · 3 years ago
      hey, can anyone attach a link of excel sheet with macro code enabled it so that i can download and experiment, I'm new to VB and I badly need to do this.
  • To post as a guest, your comment is unpublished.
    khanzafarh · 4 years ago
    Hi everyone, I have modified these code so that it works for the selected range instead of entering the specific range, However, can anyone suggest me how to modify these code to have the image in the centre of the cell. Currently the image is showing in the top left corner

    Sub URLPictureInsert()

    Dim Pshp As Shape

    Dim rCell As Range

    On Error Resume Next

    Application.ScreenUpdating = False

    For Each rCell In Selection

    filenam = rCell ActiveSheet.Pictures.Insert(filenam).Select

    Set Pshp = Selection.ShapeRange.Item(1)

    With Pshp

    .LockAspectRatio = msoTrue

    .Width = 100

    .Height = 100

    .Cut

    End With

    Cells(rCell.Row, rCell.Column + 1).PasteSpecial

    Next Application.ScreenUpdating = True

    End Sub
  • To post as a guest, your comment is unpublished.
    Moses · 4 years ago
    Thank you. It worked for me

    How do i change/modify the syntax to display image url's that are password protected
  • To post as a guest, your comment is unpublished.
    Russell Thrasher · 4 years ago
    Run-time error '1004':
    Unable to get the insert property of the Pictures class
    • To post as a guest, your comment is unpublished.
      Meg Russell · 4 years ago
      This is not working for me either. I have Excel 2013 and I simply need a straightforward piece of code that will insert images besides the urls that are in a column in my spreadsheet. Every single solution I have tried that is available via Google Search or via YouTube has rendered a pictures insert value error. What am I doing wrong??? Are the urls supposed to NOT be hyperlinks? Are they SUPPOSED to be hyperlinks? Am I supposed to identify the column range that the output goes to? I can't find a simple to follow set of instructions anywhere, please help. When I use YOUR code, I get "Unable to get the insert property of the Pictures" class:
      • To post as a guest, your comment is unpublished.
        Peter · 4 years ago
        I had the same problem and it turns out you need to check your url. if it is HTTPS that means it is a secure connection and VBA will not be able to extract it. if it is a regular HTTP there should be no problem
  • To post as a guest, your comment is unpublished.
    Danny · 4 years ago
    What issue are you getting?
  • To post as a guest, your comment is unpublished.
    RadmilaHU · 4 years ago
    I have tried the formula, but it does not seem to work. Would it have to do something with the version of Excel (I have the newest version, though)

    I appreciate your answer
  • To post as a guest, your comment is unpublished.
    Danny · 4 years ago
    This was a great help, ty so much
  • To post as a guest, your comment is unpublished.
    Shayla · 4 years ago
    Could you change the "on error resume next" to something that will wait until Google Chrome has time to open the picture? I tried this code and it works, but some of the pictures are getting pasted several rows below where they should, so I'm assuming the "on error" statement is not giving it enough time. If you think it could be something else or have any other suggestions, I'm open to hear it. Thanks!