- 帖子
- 75
- 主題
- 1
- 精華
- 0
- 積分
- 371
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- office 2007
- 閱讀權限
- 20
- 註冊時間
- 2010-5-4
- 最後登錄
- 2026-9-21
|
Sub get_stock()
Dim Url, HTMLsourcecode, GetXml
Set HTMLsourcecode = CreateObject("htmlfile")
Set GetXml = CreateObject("msxml2.xmlhttp")
Url = "http://pscnetinvest.moneydj.com.tw/z/zc/zcq/zcqa/zcqa_2330.djhtm"
With GetXml
.Open "GET", Url, False
.Send
HTMLsourcecode.body.innerhtml = .Responsetext
Set Table = HTMLsourcecode.all.tags("table")(2).Rows
For i = 0 To Table.Length - 1
For j = 0 To Table(i).Cells.Length - 1
ActiveSheet.Cells(i + 1, j + 1) = Table(i).Cells(j).innertext
Next j
Next i
End With
Set HTMLsourcecode = Nothing '釋放記憶體
Set GetXml = Nothing
End Sub '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|