Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VBA上的对象必需错误(使用VBA提交IE表单)_Vba_Runtime Error - Fatal编程技术网

VBA上的对象必需错误(使用VBA提交IE表单)

VBA上的对象必需错误(使用VBA提交IE表单),vba,runtime-error,Vba,Runtime Error,几小时前,我的代码运行得很好。但是当我现在打开文档并运行它时,我得到了错误: 运行时错误“424”:需要对象 这是我的密码: Dim ieApp As New SHDocVw.InternetExplorer ieApp.Visible = True ieApp.Navigate = "<url here; sorry, its confidential>" Do While ieApp.Busy And Not ieApp.ReadyState = READYSTATE_

几小时前,我的代码运行得很好。但是当我现在打开文档并运行它时,我得到了错误:

运行时错误“424”:需要对象

这是我的密码:

 Dim ieApp As New SHDocVw.InternetExplorer
 ieApp.Visible = True
 ieApp.Navigate = "<url here; sorry, its confidential>"

 Do While ieApp.Busy And Not ieApp.ReadyState = READYSTATE_COMPLETE
     DoEvents
 Loop

 Dim ieElement As Object
 Set ieElement = ieApp.Document.getElementById("i_specialist")
 ieElement.Value = "TestValue"
Dim ieApp作为新的SHDocVw.InternetExplorer
ieApp.Visible=True
ieApp.Navigate=“”
在ieApp.Busy而非ieApp.ReadyState=ReadyState\u完成时执行
多芬特
环
作为对象的元素
Set ieElement=ieApp.Document.getElementById(“i_专家”)
ieElement.Value=“TestValue”
错误指向:

Set ieElement=ieApp.Document.getElementById(“i_专家”)

我真的不知道出了什么问题。我在想两个可能的原因: -对象类型错误 -加载页面时出错,代码找不到字段


感谢您的帮助!谢谢

您是否在html文档页面中检查是否存在id为i_specialist的html元素? 不管怎样,当我使用htmlElements时,我就是这样做的。。值得一试

Set ie = CreateObject("InternetExplorer.Application")
    With ie
        .Visible = True
        .Navigate "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

        Do Until .ReadyState = 4
            DoEvents
        Loop

        .document.all.Item("i_specialist").Value = "TestValue"


    End With

谢谢你的替代代码!用这个代替了我的,它成功了:)仍然不确定它出了什么问题。。i_专家存在于HTML中。