Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Login to a web page & automatically fill in pasword

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
__________________________________________________ __________________________

  #3   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hellllllp Can,t remember pasword chesjak Excel Worksheet Functions 3 April 30th 08 05:07 PM
can i carryover data automatically from page to page and how? JimVT New Users to Excel 3 September 4th 07 05:42 PM
Excell VBA pasword Sparky13 Excel Discussion (Misc queries) 5 June 22nd 07 06:40 PM
How do I automatically insert the user (login name) in Excel? ABlazer Excel Discussion (Misc queries) 1 September 19th 05 02:48 AM
To print multiple selection and how to back VBA module pasword Kamran Khatri Excel Programming 5 September 8th 03 06:17 AM


All times are GMT +1. The time now is 08:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"