I've been trying to select 1 of 2 radio buttons in IE11 using Excel VBA. Here is the HTML:
<BODY><TABLE cellSpacing=0 cellPadding=0 width="90%" align=center border=0>
<TBODY>
<TR>
<TD>
<TABLE height=18 cellSpacing=0 cellPadding=0 width="100%" align=center bgColor=#336699 border=0>
<FORM method=post name=ChangeAirportForm action=/mas/ChangeAirportAction.do>
<TBODY>
<TR class=trH align=center>
<TD vAlign=top width="1%"><IMG border=0 src="https://mas.bafs.co.th/mas/include/images/l.gif" width=8 height=18></TD>
<TD width="10%"> </TD>
<TD width="29%">Airport Site Code</TD>
<TD width="29%">Airport Site Name</TD>
<TD width="30%"> </TD>
<TD vAlign=top width="1%" align=right><IMG border=0 src="https://mas.bafs.co.th/mas/include/images/r.gif" width=8 height=18></TD></TR>
<TR class=trA align=center>
<TD> </TD>
<TD><INPUT style="BORDER-TOP: 0px; BORDER-RIGHT: 0px; BORDER-BOTTOM: 0px; BORDER-LEFT: 0px" CHECKED type=radio value=1 name=airport></TD>
<TD>DMK</TD>
<TD>Donmueang</TD>
<TD> </TD>
<TD> </TD></TR>
<TR class=trB align=center>
<TD> </TD>
<TD><INPUT style="BORDER-TOP: 0px; BORDER-RIGHT: 0px; BORDER-BOTTOM: 0px; BORDER-LEFT: 0px" type=radio value=4 name=airport></TD>
<TD>BKK</TD>
<TD>Suvarnabhumi</TD>
<TD> </TD>
<TD> </TD></TR></FORM></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY>
</html>
The radio button I wish to select is the type=radio value=4 name=airport
Below is my meagre attempt which didn't work.
Sub select_radio_button()
Dim sUrl As String: sUrl = xxxxx
Dim oIE As New SHDocVw.InternetExplorer
oIE.Visible = True
oIE.Navigate sUrl
Dim oIEdoc As Object
Set oIEdoc = oIE.Document
Dim oColl as Object
Set oColl = oIEdoc.getElementsByTagName("input")
Dim obj as Object
For Each obj in oColl
If obj.getAttribute("type") = "radio" And obj.getAttribute("value") = 4 Then obj.Click
Next obj
End Sub