这是给你的功能.它将返回给定URL返回的HTML的String.
Function GetHTML(URL As String) As String
Dim HTML As String
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", URL, False
.Send
GetHTML = .ResponseText
End With
End Function
Run Code Online (Sandbox Code Playgroud)
只需确保您提供的网址格式正确.IE包括http://或https://在适当的情况下.
例如:GetHtml("www.google.com")不正确.
你想要的GetHtml("https://www.google.com/")