標題:
網頁轉檔問題 !!
[打印本頁]
作者:
oliwa
時間:
2019-7-19 11:45
標題:
網頁轉檔問題 !!
目前使用 QueryTables 下載資料 , 但執行費時 ( 不知網頁/硬體/網路....那問題 ) ,
試著學改用以下方法進行 , 目前myHTML有抓到資料 , 但myTables中則沒有資料 ( 依參考方式試著解析網頁參數 , 仍無解 )
請問以下語法那有問題 ??
Sub Test()
Dim myXML As Object
Set myXML = CreateObject("Microsoft.XMLHTTP")
Dim myHTML As Object
Set myHTML = CreateObject("HTMLfile")
With myXML
.Open "GET", "https://mops.twse.com.tw/server-java/t164sb01?step=1&CO_ID=1723&SYEAR=2019&SSEASON=1&REPORT_ID=C", False
.send
myHTML.body.innerHTML = .responseText
t = 0
'Call delay(3)
Set myTables = myHTML.getElementsByTagName("table")
For Each myTable In myTables
For Each myRow In myTable.Rows
For Each myCell In myRow.Cells
Debug.Print myCell.innerText & "---" & t
Next
Next
t = t + 1
Next
End With
Set myXML = Nothing
Set myHTML = Nothing
End Sub
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)