【问题标题】:VBA WebScraping "object variable or with block variable not set" errorVBA WebScraping“对象变量或未设置块变量”错误
【发布时间】:2020-07-22 22:02:54
【问题描述】:

运行以下 VBA 时,我不断收到“对象变量或未设置块变量”错误。我要做的就是返回 a = html.getElementById("") 但在该行上不断出现错误。我已经删除了“”之间的所有内容,因为它们是敏感细节。提前干杯

Sub web_scrape()

Dim IEobject As InternetExplorer
Dim a As Variant
Set IEobject = New InternetExplorer

IEobject.Visible = True
IEobject.navigate Url:=("website.url")
Do While IEobject.Busy = True Or IEobject.readyState <> READYSTATE_COMPLETE

      Application.Wait Now + TimeValue("00:00:01")
      Loop

Dim html As HTMLDocument
Set html = IEobject.document

html.getElementById("AuthUC$txtUserID").Value = ("")
html.getElementById("AuthUC_txtData").Value = ("")
html.getElementById("AuthUC_btnLogin").Click

a = html.getElementById("")


End Sub

【问题讨论】:

    标签: vba web-scraping


    【解决方案1】:

    是不是就像添加一个“集合”一样简单?

    set a = html.getElementById("")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多