Hello,
I'm having a hard time getting my vba code to work. What my code is doing is opening a website, entering the username and password and then I want it to click the login button. My current problem however is that I cannot get my code's loop to Click the Login button once my username and password is inputted.
Any ideas on where I'm going wrong?
I'm having a hard time getting my vba code to work. What my code is doing is opening a website, entering the username and password and then I want it to click the login button. My current problem however is that I cannot get my code's loop to Click the Login button once my username and password is inputted.
Any ideas on where I'm going wrong?
Sub Basic_Web_Query()
Dim ieApp As InternetExplorer
Dim ieDoc As Object
Dim ieTable As Object
Dim clip As DataObject
'create a new instance of ie
Set ieApp = New InternetExplorer
'you don’t need this, but it’s good for debugging
ieApp.Visible = True
'assume we’re not logged in and just go directly to the login page
ieApp.Navigate "https://app.xx.com/login"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Set ieDoc = ieApp.Document
'fill in the login form – View Source from your browser to get the control names
With ieDoc.forms(0)
.Document.all.Item("email").Value = "xx"
.Document.all.Item("password").Value = "yy"
End With
Dim loginButton As Object
Set loginButton = ieApp.Document.getElementsByClassName("btn btn-primary-lg")(0)
loginButton.Click
While ieApp.Busy Or ieApp.ReadyState <> 4: DoEvents
End Sub