0

I found some VB code here, but I need it for VBA. After reading this code I tried messing around with this code, but still trying to figure it out. Also, someone else had this problem before as shown here, but there was no explicit solution.

The code I am working with:

Sub Image1Insert()
    Application.ScreenUpdating = False
    Dim strPath As String
    strPath = "https://www.gravatar.com/avatar/fbd7dcb2d47ddcd7e6a799bde3ec0ef6?s=48&d=identicon&r=PG&f=1"
    UserForm1.Image1.Picture = LoadPicture(strPath)
End Sub

UserForm1.Image1.Picture = LoadPicture(strPath)

or UserForm1.Image1.Picture = ActiveSheet.Pictures.Insert(strPath)

Neither work, but it is the idea. Thanks in advance!

Community
  • 1
  • 1
user3553260
  • 691
  • 2
  • 9
  • 21
  • Wait, is that a... salacious picture? – findwindow Mar 28 '16 at 22:03
  • No, it is just my avatar from StackOverFlow. – user3553260 Mar 28 '16 at 22:07
  • 1
    Seems like you have to [download it first](https://social.msdn.microsoft.com/Forums/office/en-US/5fc7e8db-1bce-4b13-b049-00434757bed2/load-excel-form-image-control-from-web?forum=exceldev). Edit: oh ok =P – findwindow Mar 28 '16 at 22:08
  • The problem is that I want the image to be used whenever someone opens up the workbook. That is why I need an online source. – user3553260 Mar 28 '16 at 22:10
  • 1
    Uh did you read the link? It downloads from the internet. Edit: wait, why can't you just insert image onto userform when you build it? – findwindow Mar 28 '16 at 22:12
  • I get that it downloads from the internet, but then not sure how it would be referenced in somebody's drive. So you are telling me if I upload the image from my hard drive to the userform, then send the file to my friend, the image will appear on his computer? – user3553260 Mar 28 '16 at 22:18
  • I'll ping you tomorrow. – user3553260 Mar 28 '16 at 22:24
  • (Please don't add commentary about voting to your posts - it tends to get removed, and makes no difference to voting anyway - thanks). – halfer Mar 29 '16 at 19:29

0 Answers0