ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select Checkbox on Web Page (https://www.excelbanter.com/excel-programming/408226-select-checkbox-web-page.html)

ron

Select Checkbox on Web Page
 
I have written a macro that opens IE to the following web page

http://adds.aviationweather.gov/metars/

I am able to select certain options and values using the "set ipf"
method. However, I am unable to programmatically select either the
"Raw Format" or "Translated" radio button using the "set ipf" method.
In other words, the following code does not select the "Translated"
radio button:

Set ipf = ie.document.all.Item("std_trans")
ipf.value = "translated"

Similarly, I can't select between the "METARs" and "TAFs" checkboxes.
I've included the relevant source code below. Any help on how to make
these selections would be appreciated...TIA, Ron

<INPUT TYPE="radio" NAME="std_trans" VALUE="standard"
CHECKED Raw Format<BR
<INPUT TYPE="radio" NAME="std_trans"
VALUE="translated" Translated

<INPUT TYPE="checkbox" NAME="chk_metars"
checked METARs   
<INPUT TYPE="checkbox" NAME="chk_tafs" TAFs<BR<BR

ron

Select Checkbox on Web Page
 
For the next guy who comes along, here's what finally worked for
me...ron

for the radio button selection...
Set rad_button = ie.document.all.Item("std_trans")
For Each rb In rad_button
If rb.Value = "translated" Then
rb.Checked = False
End If

If rb.Value = "standard" Then
rb.Checked = True
End If
Next

for the checkboxes...
check_METARs = ie.document.all.Item("chk_metars").Checked

If check_METARs = True Then
Else: ie.document.all.Item("chk_metars").Click
End If

check_TAFs = ie.document.all.Item("chk_tafs").Checked

If check_TAFs = False Then
Else: ie.document.all.Item("chk_tafs").Click
End If


All times are GMT +1. The time now is 09:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com