- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
10#
發表於 2017-9-13 08:36
| 只看該作者
回復 9# ui123
Java 語言尚未入門,幫不上忙
只抓到100筆資料- Sub Ex()
- Dim oXmlhttp As Object, oHtmldoc As Object, surl, r, c, E
- Set oXmlhttp = CreateObject("msxml2.xmlhttp")
- Set oHtmldoc = CreateObject("htmlfile")
- surl = "https://finance.yahoo.com/quote/AAPL/history?period1=1473638400&period2=1505174400&interval=1d&filter=history&frequency=1d"
- With oXmlhttp
- .Open "Get", surl, False
- .Send
- oHtmldoc.write .responseText
- End With
- With oHtmldoc
- Set E = .all.tags("table")(3)
- ActiveSheet.Cells.Clear
- For r = 0 To E.Rows.Length - 1
- For c = 0 To E.Rows(r).Cells.Length - 1
- Cells(r + 1, c + 1) = E.Rows(r).Cells(c).innertext
- Next
- Next
- End With
- Set oXmlhttp = Nothing
- Set oHtmldoc = Nothing
- End Sub
複製代碼 |
|