无法使用VBA

时间:2017-01-11 09:30:26

标签: excel-vba vba excel

团队,我在这个网站上的第一个查询。

尝试从https://www.google.ca/?gws_rd=ssl#q=Bangalore+Technological+Institute+College

中提取文本[快照中突出显示]

网页打开正常 错误: Object / with block variable not set - **#91** @ Ln: *Result = Doc.getElementsByClassName("_Xbe")(1) *

请协助。我得到ClassName错了吗?

示例代码:

 Sub WebConnect()

     Dim Search_String As String

     Search_String = Sheets("Input").Range("F2").Value

     Search_String = Replace(Search_String, " ", "+")

    Dim Chrome_Path As String

    Chrome_Path = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"


    Shell (Chrome_Path & " -url http://google.ca/#q=" & Search_String)

    Application.Wait (Now + #12:00:05 AM#)

    Dim Doc As HTMLDocument

    Dim Result As String

    Dim Class_Name As String

    Result = Doc.getElementsByClassName("_Xbe")(1)

    MsgBox Result


 End Sub

0 个答案:

没有答案