Domanda

I have a map on a website which changes with time (interactive) and I would like to insert it on the excel sheet.

I am using this code but it does not show the HTML:

Private Sub Mapit()
URL = Sheets("sheet1").Cells(1, 1) //Here there is written the link to the website that want to show on excel
Sheets("sheet1").Pictures.Insert(URL).Select End Sub

Is that possible? I guess that Sheets("sheet1").Pictures.Insert(URL).Select is the problem but I am not able to find which is the correct way.

Thank you for your time

È stato utile?

Soluzione

Try this. You are almost there. No need for .Select

Sub Mapit()

    Dim URL As String
    URL = "https://www.google.com/images/srpr/logo9w.png"
    ActiveSheet.Pictures.Insert (URL)

End Sub


Private Sub Mapit()

    Dim URL As String
    URL = Sheets("sheet1").Cells(1, 1)

    ThisWorkbook.Activate
    ThisWorkbook.Sheets("sheet1").Select
    Sheets("sheet1").Pictures.Insert (URL)

End Sub

Updated after comments :

Insert Userform > Goto toolbox > Additional COntrols > Select Microsoft Web Browser > OK

Drag the control to userform

Now on userform paste below code

Private Sub UserForm_Initialize()
    Me.WebBrowser1.Navigate ("www.google.com")
End Sub
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top