technician
01-17-2009, 08:22 AM
Hi Guys
can anyone give me a source where i can download, or read information, on Access, to internet Explorer automation?
I have a company website that i would like to log onto automatically, through an access database.
Any Assistance you can give me on where i can get further information regarding automation would be most greatfull
Thanks for looking
Paul
Hi Guys
can anyone give me a source where i can download, or read information, on Access, to internet Explorer automation?
I have a company website that i would like to log onto automatically, through an access database.
Any Assistance you can give me on where i can get further information regarding automation would be most greatfull
Thanks for looking
Paul
Another poster just reported wrestling this, with some success.
http://www.access-programmers.co.uk/forums/showthread.php?t=163465
There's another thread here:
http://www.access-programmers.co.uk/forums/showthread.php?t=159105&highlight=internet+explorer+login
Here's some notes I added to my notebook based on the first thread.
One vendor sells a product that does this:
http://www.iopus.com/
Anyway I succeeded logging in to Yahoo Mail like this. Anyway, surf to the web page using your mouse and then use View > Source to see the HTML (you might need to save the page to your desktop first). Then use control-F to search the HTML code for the following items: the name of the login form, the name of the userID textbox, the name of the password textbox, and the name of the submit button. This is what I found for Yahoo mail. (Generally, the name of the item is given by "ID=....", but for forms it is literally "name=....").
<FORM name=login_form <---- login form
<INPUT class=yreg_ipt id=username name=login> <----- userName textbox
<INPUT class=yreg_ipt id=passwd type=password <-- password textbox
<INPUT type=submit value="Sign In" name=.save> <---- submit button
With the above information, code as follows.
'Add a reference to this file: shdocvw.dll
Dim IEX As SHDocVw.InternetExplorer
Set IEX = CreateObject("InternetExplorer.Application")
IEX.Visible = True
IEX.Navigate "https://login.yahoo.com/config/login?"
'Timeout after 10 seconds
Dim frm As Object, startTime As Date, secondsTranspired As Long
startTime = Now
Do While frm Is Nothing
secondsTranspired = DateDiff("s", startTime, Now)
If secondsTranspired > 10 Then
MsgBox "Timed out after " & secondsTranspired & " seconds."
Set IEX = Nothing
Exit Sub
End If
On Error Resume Next
Set frm = IEX.Document.Forms("login_Form")
Loop
On Error GoTo 0
frm.Item("username").Value = strUserName
frm.Item("passwd").Value = strPassword
IEX.Document.all.Item(".save").Click 'submit button
IEX.Quit
Set IEX = Nothing
The last line didn't work at the bank website (a different site) so I did this intead:
frm.Item(".save").Click 'submit button
technician
01-18-2009, 02:30 PM
Thanks for all your assistance Guys
As always everyone has been most helpful