如何将HTML插入Excel [英] How to insert a HTML into Excel
本文介绍了如何将HTML插入Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在网站上有一张随时间变化的地图(交互式),我想将其插入到Excel工作表中.
I have a map on a website which changes with time (interactive) and I would like to insert it on the excel sheet.
我正在使用此代码,但未显示HTML:
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
有可能吗?我猜是Sheets("sheet1").图片.插入(URL).选择是问题所在,但我找不到正确的方法.
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.
谢谢您的时间
推荐答案
尝试一下.你快到了.无需.选择
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
评论后已更新:
插入用户表单>转到工具箱>其他控制>选择Microsoft Web浏览器>确定
Insert Userform > Goto toolbox > Additional COntrols > Select Microsoft Web Browser > OK
将控件拖动到用户窗体
现在在用户窗体上粘贴以下代码
Now on userform paste below code
Private Sub UserForm_Initialize()
Me.WebBrowser1.Navigate ("www.google.com")
End Sub
这篇关于如何将HTML插入Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文