Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.Visible = True
.Navigate "http://www.tpex.org.tw/web/stock/aftertrading/daily_trading_info/st43.php?l=zh-tw"
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
.document.all("input_date").Value = Format(xYM, "E/MM")
.document.all("input_date").onchange
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
Set oNode = .document.all("input_stock_code")
oNode.Value = co_id
oNode.ParentNode.submit
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
Application.Wait Now + TimeValue("00:00:03")
Set A = .document.getElementsByTagName("table")
.document.BODY.innerHTML = A(0).outerHTML '取第1個"table"
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
.ExecWB 17, 2 ' Select All
.ExecWB 12, 2 ' Copy selection
'.Quit '關閉網頁
Sheets("工作表1").Select
With ActiveSheet '可指定工作表
.UsedRange.Clear
.Range("A1").Select
.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NOHTMLFormatting:=True
End With
End With
End Sub