我想在IE中运行报告,为此,我需要更新元素字段。
我通常使用IE.document.getElementsByName("Field id per the inspect element")(0).Value = Prop
,但是VBA抛出错误,指出“对象变量或在vba中未设置块”。
我还有其他代码,使用它们来更新元素字段而没有任何错误。
Option Explicit
Public IE As InternetExplorer
Sub Test()
Dim Prop As String
Prop = "._rpt1^._ibp"
Set IE = Nothing
Set IE = CreateObject("internetexplorer.application")
IE.Visible = True
IE.navigate "https://www.yardipcu.com/44812lennarsso/pages/menu.aspx?sMenuSet=len_iData_int"
Do While IE.readyState <> 4 Or IE.Busy: DoEvents: Loop
Do While IE.readyState <> 4 Or IE.Busy: DoEvents: Loop
IE.document.getElementsByName("PropLookup:Lookup")(0).Value = Prop
'here I receive the error
IE.document.forms(0).submit
End sub