1

到目前为止我已经得到了这个。只有 Chrome 浏览器打开(它是空的)并且它不考虑 url。我应该对 Shell 脚本进行哪些更改?

Sub ViewSource()
  Dim chromePath As String
  chromePath = """C:\Program Files\Google\Chrome\Application\chrome.exe"""

  Shell (chromePath & "view-source:http://search.yahoo.com/search;_ylt=A0oGdXgbd8FQJXoAuj6l87UF?p=cars%20parts&fr=sfp&pqstr=car%20parts")
End Sub

谢谢!

4

1 回答 1

0

我在 cmd 提示符下在 Chrome.exe 上尝试了许多不同的标志,但没有工作。

但是你可以通过这种方式获取源代码:

Sub t()
GetSource "http://search.yahoo.com/search;_ylt=A0oGdXgbd8FQJXoAuj6l87UF?p=cars%20parts&fr=sfp&pqstr=car%20parts"
End Sub

Function GetSource(url As String) As String

With CreateObject("MSXML2.XMLHTTP")
    .Open "GET", url
    .Send
    Do: DoEvents: Loop Until .Readystate = 4
    GetSource = .responsetext
    .abort
End With
于 2012-12-12T07:23:45.647 回答