I am trying to figure out how to do two things.
1. Fill in a Login Form Based on an Element ID >>
2. Press/Click a button by an element ID >>Code:Set doc = IE.Document Set el = doc.getElementById("someElementId") el.value = "Username" ' Is this correct?? How would I complete this statement? If Not el Is Nothing Then MsgBox el.innerText
I have gotten to do this in the past by using some code that uses:Code:Set doc = IE.Document Set el = doc.getElementById("someElementId") el.click ' HOw do I perform a simple click?
But it doesn't seem to work for the website I am toying around with so I was hoping to try a different method.Code:Dim htmlInput As MSHTML.HTMLInputElement Set HTMLdoc = .Document Set htmlColl = HTMLdoc.getElementsByTagName("INPUT") Do While HTMLdoc.ReadyState <> "complete": DoEvents: Loop For Each htmlInput In htmlColl If htmlInput.Name = "UserName" Then htmlInput.Value = "USername Here Else If htmlInput.Name = "Password" Then htmlInput.Value = "Password Here"
I have failed miserably searching the internet for information on IE Automation through VBA. I was hoping that someone may be able to give me a boost!




Reply With Quote
Bookmarks