首页 > 解决方案 > 对象不支持此属性或方法(运行时错误 438)使用 VBA 链接到 IE

问题描述

Sub wpieautologin()
Dim ie As SHDocVw.InternetExplorer
Dim ObjCollection As Object
Set ie = New SHDocVw.InternetExplorer
With ie
.Visible = True
.Navigate "website name"
Do
DoEvents
Loop Until .ReadyState = 4
Set ObjCollection = .Document.getElementByID("ID").Value = "insert login 
ID"

我正在尝试使用 VBA 向网站输入登录信息,但收到此错误消息。我正在使用 excel 2016。有什么想法吗?

错误在最后一行

标签: htmlexcelvbaobjectruntime-error

解决方案


尝试这个:

Set ObjCollection = .Document.getElementByID("ID")
ObjCollection.Value = "insert login ID"

推荐阅读