windows 7 位置如下:
C:\Users\<username>\AppData\Roaming\Microsoft\Templates\Normal.dotm
主要是htmlfile这个对象,粗略写了如下代码,具体请学习htmlfile这个对象
代码如下:
Function 获取网页内容(UrlRange As Range) As String
Set HTML = CreateObject("htmlfile")
Set http = CreateObject("Msxml2.ServerXMLHTTP")
HTML.designMode = "on"
urlstr = UrlRange.Value
If InStr(urlstr, "://") <= 0 Then
urlstr = "https://" &urlstr
End If
http.Open "GET", urlstr, False
http.send
获取网页内容 = http.responseText
End Function
效果如下: