igotgame
03-15-2009, 07:12 PM
Guys I am having some trouble.
I am looking at web page source below:
<TR><TD><A HREF="javascript:Needed('BorrInfo')"><IMG SRC="../images/ToDoNeeded.gif" WIDTH="10" HEIGHT="10" ALIGN="BOTTOM" border=0></A> <A HREF="javascript:GoTo('BorrInfo')"><font color=BLACK>Borrower Information</FONT></A></TD></TR>
There is no ID and no Name...so how can I reference it in order for it to be clicked? What code would I use here?
I can get it to work easily on Google.com using the code below, but being that the above page source code is javascript what would be different?:
Sub ClickLink()
' ClickLink Macro
' Macro recorded 3/15/2009 by Game
Dim htmlDoc As MSHTML.HTMLDocument
Dim htmlInput As MSHTML.HTMLInputElement
Dim htmlColl As MSHTML.IHTMLElementCollection
Set objIE = New SHDocVw.InternetExplorer
With objIE
.Navigate "https://www.google.com"
.Visible = 1
Do While .Busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
Set htmlDoc = .Document
Set htmlColl = htmlDoc.getElementsByTagName("A")
For Each htmlInput In htmlColl
If htmlInput.innerText = "Images" Then
htmlInput.Focus
htmlInput.Click
Exit For
End If
'Debug.Print "Frame " & x & ": " & htmlInput.innerText
Next htmlInput
End With
End Sub
I am looking at web page source below:
<TR><TD><A HREF="javascript:Needed('BorrInfo')"><IMG SRC="../images/ToDoNeeded.gif" WIDTH="10" HEIGHT="10" ALIGN="BOTTOM" border=0></A> <A HREF="javascript:GoTo('BorrInfo')"><font color=BLACK>Borrower Information</FONT></A></TD></TR>
There is no ID and no Name...so how can I reference it in order for it to be clicked? What code would I use here?
I can get it to work easily on Google.com using the code below, but being that the above page source code is javascript what would be different?:
Sub ClickLink()
' ClickLink Macro
' Macro recorded 3/15/2009 by Game
Dim htmlDoc As MSHTML.HTMLDocument
Dim htmlInput As MSHTML.HTMLInputElement
Dim htmlColl As MSHTML.IHTMLElementCollection
Set objIE = New SHDocVw.InternetExplorer
With objIE
.Navigate "https://www.google.com"
.Visible = 1
Do While .Busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
Set htmlDoc = .Document
Set htmlColl = htmlDoc.getElementsByTagName("A")
For Each htmlInput In htmlColl
If htmlInput.innerText = "Images" Then
htmlInput.Focus
htmlInput.Click
Exit For
End If
'Debug.Print "Frame " & x & ": " & htmlInput.innerText
Next htmlInput
End With
End Sub