Hi, i'm trying to go to a certain webpage. If its already logged in, it does some actions. If its not logged in, it logs in before executing the actions. But i need the VBA to search if the upon going to the webpage, it asks for my login details below is wat i've already written.
thanks in advance
Ian
Code:
Sub insert1()
Set ie = CreateObject("InternetExplorer.Application")
my_url1 = "https://xyz.com/admin/createib.php"
my_url2 = "https://xyz.com/admin/createprofile.php"
With ie
.Visible = True
.Navigate my_url1
Do Until Not ie.Busy And ie.readyState = 4: DoEvents: Loop
End With
If ie.URL.ToString().Contains("login") Then 'this is where i got an error msg " Object doesn't support this property or method"
ie.document.getElementById("login").Value = Sheets("PW").Range("B8")
ie.document.getElementById("password").Value = Sheets("PW").Range("C8")
ie.document.getElementById("login-btn").Click
Do Until Not ie.Busy And ie.readyState = 4: DoEvents: Loop
End If
ie.Navigate my_url1
With ie.document
.getElementById("username").Value = Sheets("IB Profile").Range("B8")
.getElementById("password").Value = Sheets("IB Profile").Range("B11")
.getElementById("name").Value = Sheets("IB Profile").Range("B7")
.getElementById("lname").Value = " "
.getElementById("email").Value = Sheets("IB Profile").Range("B10")
.getElementById("ibcode").Value = Sheets("IB Profile").Range("B9")
.getElementById("region").Value = "Asia"
.getElementById("country").Value = Sheets("IB Profile").Range("C6")
.getElementById("currency").Value = "USD"
.getElementById("balance").Value = "0"
.getElementById("IB").Value = Sheets("IB Profile").Range("d6")
.getElementById("submitchanges").Click
End With
Do Until Not ie.Busy And ie.readyState = 4: DoEvents: Loop
ie.Navigate my_url2
End Sub
thanks in advance
Ian