Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I call a JavaScript Function from Excel VBA

90 views
Skip to first unread message

save_an...@yahoo.com

unread,
Apr 17, 2006, 10:32:54 AM4/17/06
to
I am Trying to Automate the opening and copying of a information from a
website into Excel. In order to do that I first need to login... I
was able in the past to just use something like:

Set ie = CreateObject("InternetExplorer.Application")
With ie

.Visible = True

' Go to login page
.Navigate "http://www.PageIamTryingToLogon.com/"

' Loop until the page is fully loaded
Do Until .ReadyState = 4
DoEvents
Loop

' Make the desired selections on the web page and click the submit
Button

Set ipf = ie.Document.all.Item("userid")
ipf.Value = "FirstName.LastName"

Set ipf = ie.Document.all.Item("passwd")
ipf.Value = "MyPassword"

Set ipf = ie.Document.all.Item("logon")
ipf.Click

The "ipf.Click" no longer works... after they changed the website...
Now the login section code looks like that:
"...
<td valign="middle" style="HEIGHT: 23px" align="left"><input
onkeypress="return(sendLoginCheck(false));"
onblur="setLoginFlag(false);" onfocus="setLoginFlag(true);"
type="password" maxLength="30" size="20" name="passwd"></td>


<td vAlign="baseline" align="right" colSpan="2"><span
style="CURSOR:hand; cursor: pointer"
onkeypress="sendLoginCheck(false);return(false);"
onclick="sendLogin(this);return(false);"><img src="/Login.gif"
border=0></span>
</td>

..."

I would like to find a way to submit the "sendLoginCheck" in IE from
within Excel..
Any help is welcome!!!

save_an...@yahoo.com

unread,
Apr 17, 2006, 10:33:34 AM4/17/06
to

Tim Williams

unread,
Apr 18, 2006, 1:46:13 AM4/18/06
to
This works for me.

'****************************
Dim i As Integer
Dim cImgs

Set cImgs = ie.document.images

For i = 0 To cImgs.Length - 1
'Debug.Print cImgs(i).src
If cImgs(i).src Like "*Login.gif" Then
cImgs(i).parentElement.Click
End If
Next i
'***************************


Tim

<save_an...@yahoo.com> wrote in message news:1145284414.5...@g10g2000cwb.googlegroups.com...

0 new messages