1
我想通过vba将“https://investing.com/indices/us-spx-500-historical-data”的月度数据转换为excel。将网络表格数据导入excel
这里是时间框架下拉菜单中的源代码: -
<select id="data_interval" class="newInput selectBox float_lang_base_1">
<option value="Daily" selected="">Daily</option>
<option value="Weekly">Weekly</option>
<option value="Monthly">Monthly</option>
</select>enter code here
这里是表源代码:
<table class="genTbl closedTbl historicalTbl" id="curr_table" tablesorter="">enter code here
这里是我使用VBA代码,
Sub GetData()
Dim IE As Object
Dim Links
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate ("https://uk.investing.com/indices/us-spx-500-historical-data")
IE.Visible = True
Do
DoEvents
Loop Until IE.readyState = 4
Set Links = IE.document.getElementById("data_interval")
Links.selectedIndex = 2
End Sub
2是每月索引号,它可以从下拉菜单中选择月份,但表格不会从每周到每月,我也想将这些数据转化为excel
感谢哥们,它的工作在以前的IE版本,但不是当前的IE版本。 –