Use VBA to Insert Photos into Excel from URL

Поделиться
HTML-код
  • Опубликовано: 4 янв 2025

Комментарии • 106

  • @javedahmed8343
    @javedahmed8343 2 дня назад

    Simple and full of clarity

  • @lad1s1av7
    @lad1s1av7 3 месяца назад

    Excelent video in the term of detailed explanation of what are we doing so it helped me to understand how it works. Big thanks.

    • @lad1s1av7
      @lad1s1av7 3 месяца назад

      I've tried also script to delete pictures as once they are inserted in a document is grows on it's size. But I'm unable to make it work. Tried multiple different scripts and also shape approach but pictures are not deleted, while all the other objects are. Like buttons, charts, etc. Tried even to consult it with ChatGPT but with no result.

  • @danilobunetto9143
    @danilobunetto9143 Месяц назад

    Hello, great tutorial. I'm using it. Thanks. What changes can I do to use the code to all the rows of a table and jumping the rows without a link?

  • @elisehill992
    @elisehill992 2 года назад +2

    This was a success !! Thank you, that was such a helpful video

  • @romekk3975
    @romekk3975 8 месяцев назад

    Thank you very much for sharing this. It did work without any issues. I just adapted it to my own code.

  • @MrErnicoco
    @MrErnicoco 3 года назад +1

    Thanks for video! I was looking for such explanation very long.
    I really like the way you explain so I can repeat and understand more. I wish you great success

    • @DSMStrength
      @DSMStrength  3 года назад

      Well thank you very much

    • @daviddiamond4268
      @daviddiamond4268 2 года назад

      @@DSMStrength How do I insert the range of cell into the cell b2

  • @wadeemaghi4846
    @wadeemaghi4846 2 года назад

    it works, thank you! if I need to skip the empty cell and go to the next cell what should I change in the code?

  • @jillhodson524
    @jillhodson524 3 года назад +2

    This was great! I was able to create without any problem. Thank you.
    Is there a modification needed if the cell range for the pictures has merged cells?

  • @miriamfahmi6630
    @miriamfahmi6630 2 года назад +1

    Hi, what a useful tool. Thank you. It does not seem to work for MACs however, any tips?

    • @DSMStrength
      @DSMStrength  2 года назад

      Unfortubately I use pc. Excel for Mac does not function the same way

  • @Jojosmith342
    @Jojosmith342 Год назад

    Excellent. Liked & definately subscribed. Thank you so much for your time to make this video. Could you please kindly teach us how to dynamically load photos from network drive based on user's input. Ex: There are hundreds thousands of products's photos, say user is searching for product #1, photo of this product ID will be loaded automatically from network drive. Thanks a lot for your help

  • @gyaninn4587
    @gyaninn4587 3 года назад +1

    You deserve more value 👍 thanks a lot such a lovely module

  • @BboyGraphicx
    @BboyGraphicx 2 года назад +1

    Thank you this was really helpful.

  • @philippebongrand4259
    @philippebongrand4259 3 года назад +1

    Thanks a lot for this super tutorial !
    What can I add to center the photos in the column ?
    Thanks again for your super explanations !

    • @DSMStrength
      @DSMStrength  3 года назад

      I believe it does center the photos?

  • @vjaska
    @vjaska 2 года назад +1

    Very helpful tutorial, thanks - just one question, is there a way of changing the size of the picture in the VBA code so that the pictures don't reach the sides of the cell the picture is located in?

    • @DSMStrength
      @DSMStrength  2 года назад +1

      I am sorry I am not sure of a way right now

    • @vjaska
      @vjaska 2 года назад

      @@DSMStrength don't worry, managed to find the answer elsewhere. Thanks though, it was still a useful video

  • @turnswood
    @turnswood 3 года назад

    I've been looking all over for something that does this. I didn't want to copy pictures in and then manipulate them, but from a link, fill in the picture from a link. I'm going to retrieve them from one of my disks, but it's still a hyperlink. Thanks a lot. Irv in Florida

  • @dbknight3
    @dbknight3 Год назад

    This is so helpful, thank you so much for doing this! I was wondering though, I was trying to accomplish this with a link to a file in my onedrive. I have a picture file in there that I have shared for everyone and I would like to use it for the image. It is giving me an error. Would there be a different procedure for that?

  • @M4N1p
    @M4N1p 5 месяцев назад

    Great Video - I have one problem. I need my image to fit a merged cell. Any help on how this can be done?

    • @swerv5254
      @swerv5254 Месяц назад

      Hey, it's been 4 months! Did you find a way? I'm trying to do just that

  • @francisliossi2561
    @francisliossi2561 3 года назад +1

    Thanks a lot for this video!! But I still need your help! I'm trying to make the same thing, but using a Google Drive image link. However, i don't know why it doesn't work. Could you please help me?

    • @DSMStrength
      @DSMStrength  3 года назад

      gdrive image link is not the url of a file.. you might be able to get it to work with a sharing link? but you should prob upload file to g-photos

  • @darkentbg
    @darkentbg Год назад

    This is MEGA awesome, is there a way to transport the images to another sheet? I tried to designate a sheet by going Sheets("my sheet name") instead of activesheet, but it doesnt work

  • @novapearls
    @novapearls 3 года назад +1

    Very great tutorial!!!
    If the link is broken or has no picture is there a code to skip that image and go to the next ?
    Thank u!!

    • @DSMStrength
      @DSMStrength  3 года назад

      Let me check

    • @carlbarratt8403
      @carlbarratt8403 3 года назад

      @@DSMStrength is there any update as I have the same issue?

    • @LIMHERST
      @LIMHERST 2 года назад

      @@DSMStrength hey! do you have a fix for this? I'm having the same problem. Also - how can I change the range e.g. I have urls in other columns too. Thanks!

  • @ΓρηγόρηςΚαλαποθαράκος

    great video! how do I massively import images though? I mean what if I have 1000 products? it is impossible to copy-paste 1000 times the URL for each product. thank you very much.

  • @sultanzone2
    @sultanzone2 2 года назад +1

    Great help
    Tha Thanks for sharing this

  • @iiiiii-w8h
    @iiiiii-w8h 2 года назад +1

    What would happen if you edit one of the urls? What needs to be done in order for the pictures to update accordingly?

    • @DSMStrength
      @DSMStrength  2 года назад

      Delete pics and re run macro

  • @focused313
    @focused313 4 года назад +1

    This was PERFECT. Thank you.

    • @DSMStrength
      @DSMStrength  4 года назад

      thank you very much for checking out the video

  • @JesperBryde-Nielsen
    @JesperBryde-Nielsen Год назад

    It seems that there is some kind of security isse that was not in place when this was made. the 1004 errror that occures has sometthing to do with whether the link is open of not. i tried to open and keep the first 5 pictures open and then run script. That was the script imported the first 5 pictures but stopped after that. You only see the 1004 error if you delete the skip on error line

  • @hche6887
    @hche6887 Год назад

    Used the VBA code for an Image Template, but does anyone know what code to ADD to handle error if image not found, then proceed to finding the next link?

  • @roronoa_d_law1075
    @roronoa_d_law1075 Год назад

    ActiveSheet.Pictures.Insert(pic) doesn't work for images stored on aws S3 😥
    error 1004

  • @codyjenkins4376
    @codyjenkins4376 3 года назад +3

    I received a 1004 error that says unable to get the Insert property of the Pictures class. is there an easy fix for this?

    • @DSMStrength
      @DSMStrength  3 года назад

      Make sure that your links are for pictures

  • @elektriskietikli8497
    @elektriskietikli8497 3 года назад

    Thanks. This vba code is awesome. I add it as a module to my working file with a small modification, but i still can’t modify it to skip text (just text info, not hyperlink) at B4:B100 and load to C4:C100 text when in B cell is text and picture when in B cell is hyperlink.

  • @joethecockerspaniel5576
    @joethecockerspaniel5576 10 месяцев назад

    Is there a way to do the same in MS Word?

  • @daniellipkind4276
    @daniellipkind4276 3 года назад +1

    Great content! For some reason mine macro doesn't work as quick. It takes a while to load all the images meanwhile yours took less than a moment. How come? (I use Excel 2016 and each image is less than 50 kb in size)

    • @DSMStrength
      @DSMStrength  3 года назад +1

      this can be due to several reasons including speed of your computer, other things going on in your spreadsheet, number of rows, number of pictures you are trying to run this script for etc. I kept my spreadsheet really lean for the purposes of the video.

  • @kannanmassey5783
    @kannanmassey5783 2 года назад

    Thanks a lot fora helpful vedio.

  • @websitedownload713
    @websitedownload713 3 года назад

    You can use our free screenshot API to securely render an image from any URL of your excel sheet. For example if you need a preview for many links.

  • @davidtc3373
    @davidtc3373 3 года назад +1

    does it work with base64 format? please

  • @mofeidyousifhassan7625
    @mofeidyousifhassan7625 3 года назад +1

    Hello!
    Thank you so much for the video, I have tried it multiple times but it didn’t run for me, it says”can’t execute code in break mode”, may I get some help please via WhatsApp or any other app, that’s convenient for you?, I need this so bad for work, I’ll be so grateful for your help🙏🙏

  • @AmandaJones-z2p
    @AmandaJones-z2p Год назад

    does anyone know how to have an image appear in cell from google drive that is attached to google form?

  • @bakerhasan3093
    @bakerhasan3093 3 года назад +1

    thank you
    very very very much

  • @hungbuihuu4006
    @hungbuihuu4006 3 года назад

    At first, Thank you so much for sharing a wonderful VBA, however if URL links are not available, VBA returns "Run-time error '1004': Unable to get the Insert property of the Picture class"
    Do yo have any suggestion to change VBA, in case of facing error links-> step over-> come to next row to insert photos

    • @lemouga
      @lemouga 3 года назад

      Hi Thanks for this I have the same question

    • @DSMStrength
      @DSMStrength  3 года назад

      I can maybe figure something out, TBH this video was a long time ago I would have to go back through the code.
      I would suggest that you clean up the data ahead of time before running the macro if possible.

  • @osamasundhu1952
    @osamasundhu1952 2 года назад

    Your video really helped me. I just have one request, how can i lock the aspect ratio of the original image so that regardless of how i change the cell size (row and column), the image will only change according to its original aspect ratio. Im doing this so that the rest of the images in each cell that arent all of the same aspect ratio, would not get disproportionate when I have to change the column and row sizes. Also i want to be able to keep the image in the cell from spilling over to the next cell. thanks in advance!

    • @osamasundhu1952
      @osamasundhu1952 2 года назад

      in other words i want the image inserted from the url to be scaled according to its original aspect ratio, so i think it should be locked.

  • @satishbethina123
    @satishbethina123 3 года назад +1

    You can increase font size from tools options

  • @murattaylanyenigun
    @murattaylanyenigun Год назад

    Thanks, but what if an empty row is there, how the code steps for next instead of stop running

    • @murattaylanyenigun
      @murattaylanyenigun Год назад

      :) solved by myself, Set rng = Range("c4:c5,c7:c8") , skips the empty row of c6

  • @vinodsaran1537
    @vinodsaran1537 3 года назад +1

    It flags the following error for me:
    Run-time error '1004': Unable to get the Insert property of the Picture class
    What should I do?

  • @ianpdavis
    @ianpdavis 3 года назад +1

    Using this on powerpoint 2016 and it didnt work for me. Double checked the code all seems good - no error messages - just didnt do anything....

    • @DSMStrength
      @DSMStrength  3 года назад

      This is for excel not powerpoint

    • @ianpdavis
      @ianpdavis 3 года назад +1

      @@DSMStrength sorry I meant excel 2016 - was building a powerpoint pres while I watched. Seemingly cant separate the two words in my head. Any idea what might be the issue ? e.g Permissions etc ?

    • @DSMStrength
      @DSMStrength  3 года назад

      @@ianpdavis make sure that all of your references are correct... that the code is pointing to the right cells from where to get the links.

  • @Jalaj999
    @Jalaj999 3 года назад +1

    It shows "the picture can't be displayed." In the cell any solutions for this???

    • @DSMStrength
      @DSMStrength  3 года назад

      please make sure your link is correct

    • @Jalaj999
      @Jalaj999 3 года назад

      @@DSMStrength link is correct, but it don't shows the image.

  • @pahlevybagoes7050
    @pahlevybagoes7050 3 года назад +1

    How to use local path?

    • @DSMStrength
      @DSMStrength  3 года назад

      should be same way I believe

  • @matiasdepalma2948
    @matiasdepalma2948 2 года назад

    it gave me Microsoft Visal Basics for Applications
    400 (error), im tryng in two differents computers

    • @shakilash11
      @shakilash11 2 года назад

      There is some problem with https link Just change https to http

  • @lindseyoregon1771
    @lindseyoregon1771 3 года назад

    I keep getting an error at .Placement = x1MoveAndSize any Idea why?

    • @DSMStrength
      @DSMStrength  3 года назад

      I believe this has to do with the way your sheet is set up, re check that the urls actually have photos

    • @osamasundhu1952
      @osamasundhu1952 2 года назад

      you wrote x1 instead of xl so change the 1 to l as in L

  • @jesuseduardobittersuarez7517
    @jesuseduardobittersuarez7517 3 года назад +1

    1004 error dont knmow what to do

    • @DSMStrength
      @DSMStrength  3 года назад

      check your data and make sure it is correct

  • @aremudavid3368
    @aremudavid3368 2 года назад

    I'm getting this error "Sub of Function not defined"

    • @riyashete7536
      @riyashete7536 2 года назад

      Heyy getting same error please reply

  • @2minuteschool929
    @2minuteschool929 3 года назад +1

    👍👍

  • @SoyPijamas
    @SoyPijamas 3 года назад

    I need help,. this doesn't works

    • @DSMStrength
      @DSMStrength  3 года назад +1

      I assure you it does work, if you have entered the code correctly and your links are appropriate.
      Make sure you make any necessary modifications to fit your spreadsheet

  • @muhammadjamshed2128
    @muhammadjamshed2128 2 года назад

    Below code has no error but haven't show the results why?
    Sub insertimagevideo()
    Dim pic As String
    Dim mypicture As Picture
    Dim rng As Range
    Dim item As Range

    Set rng = Range("c1:c3")
    For Each item In rng
    pic = item.Offset(0, -1)
    If pic = "" Then Exit Sub
    Set mypicture = ActiveSheet.Pictures.Insert(pic)

    With mypicture
    .ShapeRange.LockAspectRatio = msoFalse
    .Width = item.Width
    .Height = item.Height
    .Top = Rows(item.Row).Top
    .Left = Columns(item.Column).Left
    .Placement = xlMoveAndSize

    End With
    Next
    End Sub

  • @muhammadjamshed2128
    @muhammadjamshed2128 2 года назад +1

    Not working please again

  • @Evermysticdesigns
    @Evermysticdesigns 2 года назад

    My code stopped at Set myPicture = ActiveSheet.Pictures.Insert(Pic) and then nothing happened , what did i do wrong ?
    Sub InsertImageVideo()
    Dim Pic As String
    Dim myPicture As Picture
    Dim rng As Range
    Dim item As Range
    Set rng = Range("d2:d100")
    For Each item In rng
    Pic = item.Offset(0, -1)
    If Pic = "" Then Exit Sub
    Set myPicture = ActiveSheet.Pictures.Insert(Pic)

    With myPicture
    .ShapeRange.LockAspectRatio = msoFalse
    .Width = itemWidth
    .Height = itemHeight
    .Top = Rows(item.Row).Top
    .Left = Columns(item.Column).Left
    .Placement = xlMoveAndSize

    End With

    Next




    End Sub

    • @Evermysticdesigns
      @Evermysticdesigns 2 года назад

      error was: Unable to get the insert property of the Picture class

    • @khajornpatrungprasitporn3972
      @khajornpatrungprasitporn3972 Год назад

      I get same the problem. that "Runtime error '1004'" and debug stop at the same your process.
      I already check the url of picture are ok. Please help me for this problem. and thank you for your video and your feed back.

  • @Pedroffs
    @Pedroffs 2 года назад

    Hello, Great explenation!
    Could you share your code?
    I am running the below code buy getting the Runtime error 1004.
    Any help?
    Sub InsertImageVideo()
    Dim pic As String
    Dim myPicture As Picture
    Dim rng As Range
    Dim item As Range
    Set rng = Range("h3:h10")
    For Each item In rng
    pic = item.Offset(0, -1)
    If pic = "" Then Exit Sub
    Set myPicture = ActiveSheet.Pictures.Insert(pic)

    With myPicture
    .ShapeRange.LockAspectRatio = msoFalse
    .Width = item.Width
    .Height = item.Height
    .Top = Rows(item.Row).Top
    .Left = Columns(item.Column).Left
    .Placement = xlMoveAndSize

    End With

    Next



    End Sub