返回列表 上一主題 發帖

[發問] 請問如何修改才能載入表格 謝謝

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 '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TOP

參考
https://www.mobile01.com/topicdetail.php?f=511&t=4737630&p=1

TOP

        靜思自在 : 看別人不順眼,是自己修養不夠。
返回列表 上一主題