How to insert a picture from the internet into VBA

2019-09-04 08:07发布

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!

0条回答
登录 后发表回答