Dim A As Date
Dim Rep_Ym As String
Dim Rep_Day As String
A = Range("A1").Value
Rep_Ym = Format(A, "yyyyMM")
Rep_Day = Format(A, "yyyyMMDD")
With ActiveSheet
If .QueryTables.Count = 0 Then
With .QueryTables.Add("URL;about:Tabs", .[B1])
.Refresh BackgroundQuery:=False
End With
End If
With .QueryTables(1)
'全部下載久一點
.Connection = "URL;http://www.twse.com.tw/ch/trading/fund/T86/print.php?edition=ch&filename=genpage/" & Rep_Ym & "/" & Rep_Day & "_2by_issue.dat&type=csv&select2=ALLBUT0999&qdate=" & Rep_Day & ""