On Error Resume Next
1: y = CLng(Application.InputBox(prompt:="輸入日期,日期格式(yyyymmdd)", Title:="輸入日期"))
x = Left(y, 6)
If y = False Then Exit Sub
If Len(y) <> 8 Or Err Then GoTo 1
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.twse.com.tw/ch/tradin ... NDEX/genpage/Report" & x & "/A112" & y & "ALLBUT0999_1.php?" _
, Destination:=Range("b1"))
.Name = "19"
.FieldNames = True