ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] CreateObject("InternetExplorer.Application") °õ¦æ§¹¦³®É·|µLªk¸õ¥X??

¦^´_ 6# t8899

¦bwith ¸Ì­±¥[¤W .AdjustColumnWidth = False¡A´N¦n¤F¡A¥i¥H¦Û¤v¥Î¿ý»s¥¨¶°¬Ý¬Ý¿ý¥X¤°»òµ{¦¡½X


Option Explicit
Sub TWSE_¥æ©ö¸ê°T()
    Dim YMD_day As String, N As Name, webURL As String
    YMD_day = InputBox("¿é¤J ¥Á°ê¦~«× : 102/10/07", "¤U¸ü¯S©w¤é´Áªº¸ê®Æ", Format(Date - 1, "E/MM/DD")) '¥Á°ê¦~«× "102/10/07"
    With ActiveSheet  '¥i«ü©w¤u§@ªí
        '·í¤é¨R¾P¥æ©ö¼Ðªº¤Î²Î­p
        webURL = "URL;http://www.twse.com.tw/ch/trading/exchange/TWTB4U/TWTB4U.php?input_date=" & YMD_day & "&login_btn=¬d¸ß.dat"
        '¹dÃB¥æ©ö¤é¦¨¥æ¸ê°T
        'webURL = "URL; http://www.twse.com.tw/ch/trading/block/BFIAUU/BFIAUU.php?input_date=" & YMD_day & "&login_btn=¬d¸ß.dat"
        'webURL = "URL; http://www.twse.com.tw/ch/trading/block/BFIAUU/BFIAUU.php?input_date=" & YMD_day & "&login_btn=%ACd%B8%DF.dat"
        If .QueryTables.Count = 0 Then
            .QueryTables.Add Connection:=webURL, Destination:=.Range("A1")
        Else
            .QueryTables(1).Connection = webURL
        End If
        .Cells.Clear
        With .QueryTables(1)
            .AdjustColumnWidth = False
            .WebSelectionType = xlSpecifiedTables
            .WebFormatting = xlWebFormattingNone
           ' .WebTables = "data_table"  '¹dÃB¥æ©ö¤é¦¨¥æ¸ê°T     :¸ê®Æ¶×¤JªºTables
            .WebTables = "9,11"         '·í¤é¨R¾P¥æ©ö¼Ðªº¤Î²Î­p :¸ê®Æ¶×¤JªºTables
            .Refresh BackgroundQuery:=False
        End With
    End With
End Sub

TOP

        ÀR«ä¦Û¦b : §g¤l¥ß«í§Ó¡A¤p¤H«í¥ß§Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD