I am trying to click a link in a website as showed in screenshot below. This link's HTML code is like <a target="_blank" href="gamit_main.htm?gamitId=163734">'3311-10310</a>
.
So that I have a code to click the link like:
Set HTMLDoc = ie.Document
HTMLDoc.getElementsByTagName("a").Click
But I got error as:
"Object doesn't support this property or method".
Ref code snap:
The full code:
Sub Something()
Dim ie As Object
Dim HTMLDoc As MSHTML.HTMLDocument
Dim ckt_No As String
ckt_No = Range("A2").Value
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ShowWindow ie.Hwnd, SW_MAXIMIZE
ie.Navigate "http://xyw.htm"
Do While ie.Busy = True Or ie.ReadyState <> 4: DoEvents: Loop
ie.Navigate "http:dgetcjdm_ckt_No&display_content=Y&noFormFields=Y&refresh=Y"
Do While ie.Busy = True Or ie.ReadyState <> 4: DoEvents: Loop
Set HTMLDoc = ie.Document
HTMLDoc.getElementById("resultRow").getElementByTagName("a")(0).Click
End Sub
The HTML Code as follows:
<td align="center" height="15" title="1" class="tdborder">
<font class="rtabletext">1</font>
</td>
<td align="Left" title="GAMITARM Status Date" class="tdborder" nowrap="">
<font class="rtabletext">19-MAR-2020</font>
</td>
<td align="Left" title="Circuit Number" class="tdborder" nowrap="">
<font class="rtabletext"><a target="_blank" href="gamit_main.htm?gamitId=168592">'70F934C8</a></font>
</td>
<td align="Left" title="CUSTOMER" class="tdborder" nowrap="">
<font class="rtabletext">MICROSOFT CORPORATION</font>
</td>
<td align="Left" title="Customer Id" class="tdborder" nowrap="">
<font class="rtabletext">8684</font>
</td>
<td align="Left" title="AO AM" class="tdborder" nowrap="">
<font class="rtabletext"> </font>
</td>
<td align="Left" title="AO SD" class="tdborder" nowrap="">
<font class="rtabletext"> </font>
</td>
<td align="Left" title="AO ED/AVP" class="tdborder" nowrap="">
<font class="rtabletext"> </font>
</td>
<td align="Left" title="AO VP" class="tdborder" nowrap="">
<font class="rtabletext"> </font>
<td align="Left" title="LCON Phone Contact (SM Feed) " class="tdborder" nowrap="">
<font class="rtabletext"> </font>
</td>
<td align="Left" title="LCON Cell Contact (SM Feed) " class="tdborder" nowrap="">
<font class="rtabletext"> </font>
</td>
<td align="Left" title="Programme Office Status" class="tdborder" nowrap="">
<font class="rtabletext">New</font>
</td>
<td align="Left" title="Major Initiative" class="tdborder" nowrap="">
<font class="rtabletext">Ethernet</font>
</td>
<td align="Left" title="Project" class="tdborder" nowrap="">
<font class="rtabletext">APAC Singapore Ethernet Tail Rolls</font>
</td>
<td align="Left" title="Phase" class="tdborder" nowrap="">
<font class="rtabletext">x.2.2.a</font>
</td>
<td align="Left" title="LOA received" class="tdborder" nowrap="">
<font class="rtabletext">NO</font>
</td>
<td align="Left" title="Technical Connectivity details received" class="tdborder" nowrap="">
<font class="rtabletext">NO</font>
</td>
</tr>
and am trying to focus on this line
<font class="rtabletext"><a target="_blank" href="gamit_main.htm?gamitId=168592">'70F934C8</a></font>
Here some snap for parent: Plz find the Highlighted elements