Re: Automate Input Login & Password
I've got a workbook that does exactly this.
You need to do a scan on the login page of the website to find out what the boxes are named as in the HTML coding.
You can use this to get the names of all the things on the site...
Code
Private Sub CommandButton1_Click()
On Error Resume Next
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate "URL STRING HERE"
ie.Visible = True
Do While ie.Busy And Not ie.readyState = 4
DoEvents
Loop
DoEvents
Dim k As Integer
Do While ((ie.Busy) And (Not (ie.readyState = 4)))
DoEvents
Loop
MsgBox ("start now")
Dim i As Integer
Dim holder As Long
'j = 0
For i = 1 To ie.document.all.Length - 1
holder = 0
Sheets("Sheet1").Cells(i, 2) = ie.document.all.Item(i).tagName
Sheets("Sheet1").Cells(i, 1) = ie.document.all.Item(i).href
holder = InStr(1, ie.document.all.Item(i).href, "SuminBoxes.xls", vbTextCompare)
If holder > 0 Then
j = j + 1
Sheets("Sheet1").Cells(j, 3) = ie.document.all.Item(i).tagName
Sheets("Sheet1").Cells(j, 4) = ie.document.all.Item(i).Name
Next i
DoEvents
End Sub
Display More
Then when you have the names of the items for the username, password and log in buttons you can use something like;
Say your log in name in written in cell A1 of sheet1 and the password is in cell A2 of sheet1.
Code
Private Sub CommandButton1_Click()
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate Sheets("Sheet1").Cells(8, 5)
ie.Visible = True
Do While ie.Busy And Not ie.readyState = 4
DoEvents
Loop
DoEvents
ie.document.all.Item("UserNameFieldName").Value = Sheets("Sheet1").Range("A1")
ie.document.all.Item("PasswordFieldName").Value = Sheets("Sheet1").Range("A2")
ie.document.all.Item("LoginButtonName").Click
End Sub
Display More
hope that helps,
Ian