T
tmp2100
I have an excel VBA macro to access a website, fill in some
fields of a form, and then submit it. The macro works fine, but I am stuck on
how
to formulate a statement to choose a 'select-list' option:
Sub XYZDataFetch()
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate http://websitename_goes_here.com
Do Until ie.ReadyState <> 1: DoEvents: Loop
' ******** here is where the statement goes to choose select-list option
*******
ie.document.all.Item("cstep").Click
ie.document.all.Item("request").Value = "Summary Table"
ie.document.forms(0).submit
' more code goes here
End Sub
The webpage I am accessing is written in javascript and contains
the following select list object:
<select name="tspan" onChange="ckCustomSpanVisible();">
<option>All times</option>
<option>Last 15 mins</option>
<option>Last hour</option>
<option selected="selected">Last 4 hours</option>
<option id="custom">Custom</option>
</select>
QUESTION: at the indicated location in my macro VB code, what is the
statement
needed to force the select option away from the default 'Last 4 hours' and to
select 'Custom' instead ?
thanks,
tmp2100
fields of a form, and then submit it. The macro works fine, but I am stuck on
how
to formulate a statement to choose a 'select-list' option:
Sub XYZDataFetch()
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate http://websitename_goes_here.com
Do Until ie.ReadyState <> 1: DoEvents: Loop
' ******** here is where the statement goes to choose select-list option
*******
ie.document.all.Item("cstep").Click
ie.document.all.Item("request").Value = "Summary Table"
ie.document.forms(0).submit
' more code goes here
End Sub
The webpage I am accessing is written in javascript and contains
the following select list object:
<select name="tspan" onChange="ckCustomSpanVisible();">
<option>All times</option>
<option>Last 15 mins</option>
<option>Last hour</option>
<option selected="selected">Last 4 hours</option>
<option id="custom">Custom</option>
</select>
QUESTION: at the indicated location in my macro VB code, what is the
statement
needed to force the select option away from the default 'Last 4 hours' and to
select 'Custom' instead ?
thanks,
tmp2100