hoping someone can point to where my issue is with my code. I'm getting runtime error 91: Object variable or with block variable not set
with the following code:
Dim ie As New SHDocVw.InternetExplorer
Dim htmldoc As MSHTML.HTMLDocument
Dim htmlinput As MSHTML.IHTMLElement
Dim htmlbuttons As MSHTML.IHTMLElementCollection
'see window and navigate to website
ie.Visible = True
ie.navigate "WEBSITE"
'wait for brower to load
Do While ie.readyState <> READYSTATE_COMPLETE
Loop
'enters username and password
Set htmldoc = ie.document
Set htmlinput = htmldoc.getElementById("USER")
htmlinput.Value = "USER1"
Set htmlinput = htmldoc.getElementById("PASSWORD")
htmlinput.Value = "PASS1"
'finds form > submit button (under class = "LoginSubmit")
htmldoc.forms(0).submit
When I try to debug, htmlinput.Value = "USER
is highlighted. I should mention that the site loads, and accepts user/password properly, but I get the error after successfully logging in.
Thanks very much!