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