返回列表 上一主題 發帖

大盤歷史資料查詢

大盤歷史資料查詢

本帖最後由 GBKEE 於 2016-2-19 08:35 編輯

請問大大:
1.如何在台灣證卷交易網站上,找到"查詢"的按鍵名稱?(紅框)
http://www.twse.com.tw/ch/tradin ... T/MI_5MINS_HIST.php


2. 另外如何抓下查詢完的資料(藍框)?

在原始檔中有找到按鍵位置,都是不知道如何使用?
2016-01-10_225430.png

Sub 大盤指數20160110()
    Dim xTable As Object, k As Integer, c As Integer, r As Integer
   
    Sheets("下載").Select
   
    URL = "http://www.twse.com.tw/ch/trading/indices/MI_5MINS_HIST/MI_5MINS_HIST.php"
   
        With CreateObject("InternetExplorer.application")
        .Visible = True
        .Navigate URL
        Do While .Busy Or .readyState <> 4: DoEvents: Loop
                 With .document
                    .all("myear").Value = "104"
                    .all("mmon").Value = "12"
                    .all("onclick").Click                    '按下按鍵的
                End With
        Do While .Busy Or .readyState <> 4: DoEvents: Loop
        Set xTable = .document.getElementsByTagName("tbody") '(1)
        
               
        With Sheets("下載")
            .UsedRange.Clear
            k = 1
            For i = 0 To 1 ' For EACH  E In xTable  '.document.getelementsbytagname("TABLE")
                        For r = 0 To xTable(i).Rows.Length - 1
                            For c = 0 To xTable(i).Rows(r).Cells.Length - 1
                                .Cells(k + r, c + IIf(i = 0, 1 + 1 * c, 1)) = xTable(i).Rows(r).Cells(c).innerText
                            Next
                        Next
                 k = k + xTable(i).Rows.Length
            Next
        End With
        .Quit
    End With

End Sub

TOP

感謝GBKEE大大的幫忙!
XTABLE內的資料,還是無法清楚看到,請可以在說明一下嗎??

TOP

        靜思自在 : 人生沒有所有權,只有生命的使用權。
返回列表 上一主題