Ok, I posted simplistic code to log into i-google or other page. http://www.ozgrid.com/forum/showthread.php?t=80955
Problem is after testing I found that some pages never reach an IE ready state of 4, and only 3. Thus I tweaked the code so it auto toggles back to 3 and added DOM object detection to ensure proper object selection. Enjoy. Was geekin out a little, sorry.
Code
Enum READYSTATE
READYSTATE_UNINITIALIZED = 0
READYSTATE_LOADING = 1
READYSTATE_LOADED = 2
READYSTATE_INTERACTIVE = 3
READYSTATE_COMPLETE = 4
End Enum
Sub AutoLogon()
'USE - AUTOLOGON
'*****************************************************
'***************** NOTES *****************************
'CODE TO MOVE TO A WEBPAGE
'ie.navigate ("https://webpage_goes_here")
'Call READYSTATE(ie)
'****************************************************
'****************************************************
'DEC VARS
Dim intPos1 As Integer 'DOM OBJECT 1
Dim intPos2 As Integer 'DOM OBJECT 2
Dim intDefState As Integer 'INT TO HOLD BASE STATE VALUE
Dim AGAIN as label
'SET VALS
Set ie = CreateObject("InternetExplorer.application") 'CREATE OBJECT
ie.Visible = True 'MAKE IE PAYNE VISIBLE
ie.navigate ("https://www.google.com/accounts/ServiceLogin?service=ig&passive=true&continue=http://www.google.com/ig%3Fhl%3Den&followup=http://www.google.com/ig%3Fhl%3Den&cd=US&hl=en&nui=1<mpl=default")
Call READYSTATE(ie) 'CHECK STATE OF PAGE
AGAIN: 'IF FINDDOM IS FAILING REPEAT THE PROCESS
intPos1 = 0
intPos1 = FindDom(ie, "Email")
If intPos1 = -1 Then GoTo AGAIN
intPos2 = 0
intPos2 = FindDom(ie, "Passwd")
If intPos1 = -1 Then GoTo AGAIN
'WEBPAGE INJECTION OF VALUES
ie.Document.forms(0).all(intPos1).value = "youremail"
Call READYSTATE(ie)
ie.Document.forms(0).all(intPos2).value = "yourpass"
Call READYSTATE(ie)
ie.Document.forms(0).submit 'HIT SUBMIT
End Sub
Sub READYSTATE(ie)
'WAIT ROUTINE TO WAIT FOR PAGE TO BECOME INTERACTIVE
'SET VALS
intDefState = 4
bump = 0
Do
If ie.READYSTATE = intDefState Then
ie.Visible = True
Exit Do
Else
DoEvents
End If
bump = bump + 1 'SMARTSTATE COUNTER
'IF READYSTATE NEVER REACHES 4 ROLL BACK TO 3 SOME PAGES WILL NEVER REACH 4
If bump > 1000 Then
If intDefState = 4 Then
intDefState = 3
ElseIf intDefState = 3 Then
intDefState = 4
End If
Exit Do
End If
Loop
End Sub
Function FindDom(ie, strLookDom As String)
'USE-SCAN DOM TO FIND OBJECT ON WEBPAGE
'DEC VARS
Dim lblDie As Label
Dim lblDie2 As Label
Dim strTestval As String 'STRING VAR TO HOLD DOM ID
On Error GoTo lblDie
intNuminDom = ie.Document.all.Length 'GET COUNT OF DOM OBJECTS ON WEBPAGE
For x = 0 To intNuminDom
strTestval = UCase(ie.Document.forms(0).all(x).ID)
If strTestval = UCase(strLookDom) Then
FindDom = x
GoTo lblDie2
End If
Next x
lblDie: 'PREVENT ENDLESS LOOP
lblDie2: 'DOUBLE CHECK VALUE BEFORE PROCEEDING
If Len(Trim(FindDom)) = 0 Then FindDom = -1
End Function
Display More