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版本。 –