返回列表 上一主題 發帖

有關EXCEL VBA 抓取不到完整網址CSV問題

Sub TEXT_102()
    Dim YMD_day As String, N As Name, webURL As String
    YMD_day = InputBox("輸入 民國年度日期 : 102/10/07", "下載特定日期的資料", Format(Date - 1, "E/MM/DD"))
    With Sheets("下載資料")
       For Each N In .Names
            'N.Delete
       Next
        .Cells.Clear
       GetData_URL = "URL;http://www.twse.com.tw/ch/trading/block/BFIAUU/BFIAUU.php?edition=ch&filename=genpage/A" & YMD_day & ".dat&type=csv"
        'webURL = "URL; http://www.twse.com.tw/ch/trading/block/BFIAUU/BFIAUU.php?input_date=" & YMD_day & "&login_btn=查詢.dat"
        With .QueryTables.Add(Connection:=GetData_URL, Destination:=.Range("A1"))
            .WebSelectionType = xlSpecifiedTables
            .WebFormatting = xlWebFormattingNone
            .WebTables = "data_table"
            .WebPreFormattedTextToColumns = True
            .WebConsecutiveDelimitersAsOne = False
            .WebSingleBlockTextImport = False
            .WebDisableDateRecognition = False
            .WebDisableRedirections = True
            .Refresh BackgroundQuery:=False
        End With
    End With
End Sub

TOP

        靜思自在 : 對父母要知恩,感恩、報恩。
返回列表 上一主題