How to insert a HTML into Excel

﹥>﹥吖頭↗ 提交于 2021-02-08 06:09:16

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/22223255/how-to-insert-a-html-into-excel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!