PDA

View Full Version : Logging into a website



matt419
04-23-2016, 06:55 PM
Hey guys,

I'm trying to login to my Overstock account with VBA.

I need to open the link in the code, have it fill in my email and password into the form on the right and then click/submit the green "Sign In" button.

I've got the email and password entry working, but can't seem to figure out how to structure actually submitting the form.

Any help is appreciated. I can't post links so I used (( )) in the code.

Thanks guys!


Sub Button2_Click()the_start:
Set ObjIE = CreateObject("InternetExplorer.Application")
ObjIE.Top = 0
ObjIE.Left = 0
ObjIE.Width = 1200
ObjIE.Height = 1200
ObjIE.AddressBar = 0
ObjIE.StatusBar = 0
ObjIE.Toolbar = 0
ObjIE.Visible = True

Website = "overstock((com))/myaccount?TID=SIGNIN"


ObjIE.Navigate (Website)


Do
DoEvents
On Error Resume Next

If Err.Number <> 0 Then


Set ObjIE = Nothing
GoTo the_start:

End If
Loop Until ObjIE.readyState = 4

ObjIE.document.getElementById("loginEmailInput").Value = "sampleemail"

ObjIE.document.getElementById("loginPasswordInput").Value = "samplepassword"

Application.Wait (Now + TimeValue("00:00:02"))

ObjIE.document.getElementById("loginForm").Click