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

Hi
IE v6.0

This is my 1st attempt at this , so please bear with me.

I want to logon to my banks site & get my stock/shares values to add to a
worksheet.
I need vba to fill in the logon password/ID boxes on the login page for me.

I got to get past the first page that requires the passwords etc, but
there's a second page with a continue button that's stumped me.
It won't accept .click or .submit:

This is as far as I've got:
the ** line is the problem

Have I got the right page/form?

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

sSearchTerm = "programically fill out web form"

sURL = '"https://www.mybank.co.uk/frames/login_body.asp"

'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("txtCustomerID").Value = "MyID"
oIE.Document.all("txtPassnumber").Value = "MyPass"
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("Continue").click
End Sub

This is the source code (& a bit more I think):

<td align="center" valign="bottom"
<table width="50%" border="0" cellspacing="0" cellpadding="2"
<tr
<td class="table-light" align="left" valign="bottom"<a
href="/frames/history_reset_redirect.asp?FramesPage=/frames/logoff_body_2.as
p" target="_top""<img border="0" src="../pixels/button_logout.gif"
alt="Log Out" TITLE="Log Out" NAME="Log Out"</a</td
<td class="table-light" align="right" valign="bottom"<a href="
" target="_self"<img src="../pixels/button_continue.gif" border="0"
alt="continue" TITLE="Continue" NAME="Continue"</a</td
</tr
</table
</td

There doesn't seem to be a help for the IE object model.. is this correct &
Is there a way to get Intelisnese to work within the the IDE for this?

If there's any other improvements I can make, please feel free to tell me.
Hope you can help.
Dave F.