Unable to 'click' on a link in IE Web page

saisank1

New Member
Joined
Jan 20, 2014
Messages
3
HI All,

I am trying to 'click' on a link within the page I got loaded using VBA, however, I am not able to. Here is the complete code below & the HTML code bit with link I wanted to 'click'. Any help will be useful.

Thanks in advance:

Option Explicit

Sub TAMIT_Login()
Dim lnkOverRide
Dim i As Object
Const READYSTATE_COMPLETE As Integer = 4
Dim objIE, lnkAssets As Object
Dim Name_ip, TamID, TamPwd As String
Dim evt, lst As Object
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Visible = False
.Silent = True
.Navigate Range("C3").Value
Do Until .readyState = READYSTATE_COMPLETE
DoEvents
Loop
End With
Set lnkOverRide = objIE.document.getElementById("overridelink")
If Not lnkOverRide Is Nothing Then
lnkOverRide.Click
End If
Do Until objIE.readyState = READYSTATE_COMPLETE
DoEvents
Loop
IDPwd.Show
TamID = Range("IV1").Value
TamPwd = Range("IV2").Value
objIE.document.getElementById("j_username").Value = TamID
objIE.document.getElementById("j_password").Value = TamPwd
objIE.document.getElementById("loginbutton").Click
objIE.Visible = True
Application.Wait (Now + TimeValue("0:00:5"))
For Each i In objIE.document.GetElementsByTagName("span")
If (i.innertext = "Assets") Then
'MsgBox i.innerhtml
'MsgBox i.innertext
i.Focus
i.Click '<-- This is where I am struck'
Exit For
End If
'MsgBox i.innertext
Next

End Sub


HTML Code Bit:
<span align='middle' ctype="label" id="mx108" tabindex="0" ev="ASSET" targetid="mx108" mxevent="click" class="text favappsportletlink " style="display:block;;cursor:pointer;;;" title="Assets "><img id='mx108_image' src='../webclient/skins/tivoli09/images/appimg_asset.gif' class='favappsportletlinkimg' border='0' alt="Assets" style='vertical-align:top;margin:0px;margin-left:3px;margin-right:3px;'/>Assets</span></div></td> <td class="prs"></td>
 
Last edited:

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,215,593
Messages
6,125,715
Members
449,254
Latest member
Eva146

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top