View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
sal21[_55_] sal21[_55_] is offline
external usenet poster
 
Posts: 1
Default Login to a web page & automatically fill in pasword


Wrote:
Hi Dave,

I am trying to do something similar and was on the board looking for
solutions...

I started with something like this ....
it filled in the Username and Password ... my problem is that on the
site I am hitting another window opens up which I am trying to figure
out how to close so that the focus is returned to the login window.

__________________________________________________ _____________________________
Public Sub FillInUserName()
Dim brokerAcct As InternetExplorer
Dim OBJ As Object

Set brokerAcct = New InternetExplorer
brokerAcct.Visible = True
brokerAcct.Navigate "<<login URL"
Do Until brokerAcct.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop


'Log on
Set OBJ = brokerAcct.Document.all.Item("userName")
OBJ.Value = "<<USERNAME"
Set OBJ = brokerAcct.Document.all.Item("Password")
OBJ.Value = "<<PASSWORD"
Set OBJ = brokerAcct.Document.all.Item("<<loginform")
ifp.Submit

brokerAcct.Quit
Set brokerAcct = Nothing


End Sub
__________________________________________________ __________________________


I have arranged your code but vba return error (block variable not
dedfined-run time 91) why?


Sub LoginSite()
Dim oIE As New SHDocVw.InternetExplorer
Dim sSearchTerm As String
Dim sURL As String

sSearchTerm = "programically fill out web form"

sURL = "http://liberomail.libero.it/"

'open a new, visible IE window
Set oIE = New SHDocVw.InternetExplorer
oIE.Visible = True

'go to desired page
oIE.Navigate sURL

'wait for page to finish loading
Do Until oIE.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

oIE.Document.all("Username:").Value = Range("a1")
oIE.Document.all("Password:").Value = Range("b1")
oIE.Document.all("Dominio:").Value = Range("c1")

oIE.Document.forms(0).submit
Do Until oIE.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
' **oIE.Document.forms(0).submit
' This doesn't work either:
' oIE.Document.all("entra").click
End Sub

TIA, Sal


--
sal21


------------------------------------------------------------------------
sal21's Profile:
http://www.excelforum.com/member.php...fo&userid=2040
View this thread: http://www.excelforum.com/showthread...hreadid=314336