I am very new to VBA, I've been tried many times to use Excel VBA to select the value on a website, but it doesn't work. Below is the code I use. Actually I don't know how to get the elements since it has no "id" or "name" tag.
Sub GetFinanceData()
Dim URL As String
URL = "http://ift.tt/1Oo601c"
Set myIE = CreateObject("InternetExplorer.Application")
With myIE
.navigate URL
.Visible = True
Do While .Busy = True Or .readyState <> 4
Loop
DoEvents
.Document.parentWindow.execScript "selectData(zero);", "JavaScript"
End With
End Sub
Below is the HTML code, I want to change the option value to "zero" when open the website, can anybody help to check and advise what VBA code I can use to get the value "zero"? Thanks a lot in advance!
<a name="a1" id="a1"></a>
<div class="part02">
<div class="sub01">
<div class="sub01_tt fblue">
<span class=" selected"><a href="#a1" target="_self">重要财务指标</a></span>
<span class=""><a href="#a2" target="_self">资产负债表</a></span>
<span class=""><a href="#a3" target="_self">现金流量表</a></span>
<span class=""><a href="#a4" target="_self">综合损益表</a></span>
<em class="rt">报表类型:<select class="fgrey" style="width:100px;" interface="getFinanceStandardForjs?symbol=$symbol&financeStanderd=" table="tableGetFinanceStandard" onchange="selectData(this);">
<option value="all" >全部</option>
<option value="zero" >年报</option>
<option value="1" >中报</option>
<option value="2" >一季报</option>
<option value="3" >三季报</option>
</select></em>
</div>
<div class="sub01_cc">
<div class="sub01_c">
<table cellspacing="0" cellpadding="0" border="0" class="tab05">
<tbody id="tableGetFinanceStandard">
<tr>
Aucun commentaire:
Enregistrer un commentaire