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

¦³ÃöEXCEL VBA §ì¨ú¤£¨ì§¹¾ãºô§}CSV°ÝÃD

¦^´_ 22# joey0415

·Q½Ð±Ð¤j¤j
¤U¦Cºô§}
http://www.twse.com.tw/ch/trading/block/BFIAUU/BFIAUU.php?combination_choice=sub&cno=1&input_date=102/11/06
¥i¤£¥i¥H¤]¥Îquerytable©O¡H

TOP

¦^´_ 31# jak
  1. Option Explicit
  2. Sub ExA()
  3.     With ActiveSheet
  4.         With .QueryTables.Add("URL;http://www.twse.com.tw/ch/trading/block/BFIAUU/BFIAUU.php?combination_choice=sub&cno=1&input_date=102/11/06", .[A1])
  5.             .WebSelectionType = xlSpecifiedTables
  6.             .WebFormatting = xlWebFormattingNone
  7.             .WebTables = """data_table"""
  8.             .WebPreFormattedTextToColumns = True
  9.             .WebConsecutiveDelimitersAsOne = True
  10.             .WebSingleBlockTextImport = False
  11.             .WebDisableDateRecognition = False
  12.             .WebDisableRedirections = False
  13.             .Refresh BackgroundQuery:=False
  14.         End With
  15.     End With
  16. End Sub
  17. Sub ExB()
  18.     With ActiveSheet
  19.         With .QueryTables(1)
  20.            ' .WebSelectionType = xlSpecifiedTables
  21.            ' .WebFormatting = xlWebFormattingNone
  22.            ' .WebTables = """data_table"""
  23.            ' .WebPreFormattedTextToColumns = True
  24.            ' .WebConsecutiveDelimitersAsOne = True
  25.            ' .WebSingleBlockTextImport = False
  26.            ' .WebDisableDateRecognition = False
  27.            ' .WebDisableRedirections = False
  28.             .Refresh BackgroundQuery:=False
  29.         End With
  30.     End With
  31. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 32# GBKEE

½Ð°Ý¶Wª©¡G


     Sub ExB()
        With ActiveSheet
            With .QueryTables(1)
                .Refresh BackgroundQuery:=False

            End With
        End With
    End Sub

¬õ¦r³B¬°¤°»òÁÙ­n¼g²Ä¤G­ÓSUB©O¡H
.QueryTables(1)

³o¤S¬O¤°»ò©O¡H¬Oªí¥Ü¦³¤@­ÓQueryTables¶Ü¡H
¬°¦ó¤S­n¦A¤@¦¸ .Refresh BackgroundQuery:=False[

ÁÂÁ¶Wª©

TOP

¦^´_ 33# joey0415
Sub ExA() ¬O·s¼W¤@­ÓQueryTable
Sub ExB() ¬O©µÄò³oQueryTable¤¤¬d¸ß,¤£¥²¤@ª½¥Î.QueryTables.Add,·|¦û¥Î¸ê·½
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

gbkee,c_c_lai±z¦n¡G

§Ú¤]¦³¤W­zªº°ÝÃD¡A¤]¬OÃÒ¥æ©Òºô¯¸°ÝÃD¡A¦ý¸Õ¤F«Ü¤[³£¨S¦³µ²ªG¡A¥i¥H½Ð±Ð°ª¤â¬O­þ¸Ì¥X¿ù¤F¶Ü? ÁÂÁ±z
http://www.twse.com.tw/ch/trading/exchange/TWT93U/TWT93U.php#
  1. Sub TEST123()
  2.     Dim YMD_day As String, N As Name, webURL As String
  3.     YMD_day = InputBox("¿é¤J ¥Á°ê¦~«×¤é´Á : 102/10/07", "¤U¸ü¯S©w¤é´Áªº¸ê®Æ", Format(Date - 1, "E/MM/DD"))
  4.     With Sheets("¤U¸ü¸ê®Æ")
  5.        For Each N In .Names
  6.             'N.Delete
  7.        Next
  8.         .Cells.Clear
  9.        GetData_URL = "URL;http://www.twse.com.tw/ch/trading/exchange/TWT93U/TWT93U.php?edition=ch&filename=genpage/A" & YMD_day & ".dat&type=csv"
  10.         'webURL = "URL; http://www.twse.com.tw/ch/trading/block/BFIAUU/BFIAUU.php?input_date=" & YMD_day & "&login_btn=¬d¸ß.dat"
  11.         With .QueryTables.Add(Connection:=GetData_URL, Destination:=.Range("A1"))
  12.             .WebSelectionType = xlSpecifiedTables
  13.             .WebFormatting = xlWebFormattingNone
  14.             .WebTables = "data_table"
  15.             .WebPreFormattedTextToColumns = True
  16.             .WebConsecutiveDelimitersAsOne = False
  17.             .WebSingleBlockTextImport = False
  18.             .WebDisableDateRecognition = False
  19.             .WebDisableRedirections = True
  20.             .Refresh BackgroundQuery:=False
  21.         End With
  22.     End With
  23. End Sub
½Æ»s¥N½X

TOP

¦³ÃöEXCEL VBA §ì¨ú¤£¨ì§¹¾ãºô§}CSV°ÝÃD

¦U¦ì°ª¤â±z¦n¡A

¦]­n§ì¥ý«e¤wª¦¤å¡Ahttp://forum.twbts.com/viewthread.php?tid=10770¡A­×§ï¹L«á¡A¸ê¤´±a¤£¥X¨Ó¡A½Ð·Q°Ý¦U¦ì°ª¤â¬O§_php«á­±ªº»yªk¨Ï¥Î¦³»~¡AÁÂÁ¤j®a^^

http://www.twse.com.tw/ch/trading/exchange/TWT93U/TWT93U.php
  1. Option Explicit
  2. Sub ExA()
  3.     With ActiveSheet
  4.         With .QueryTables.Add("URL;http://www.twse.com.tw/ch/trading/exchange/TWT93U/TWT93U.php#?combination_choice=sub&cno=1&input_date=103/02/25", .[A1])
  5.             .WebSelectionType = xlSpecifiedTables
  6.             .WebFormatting = xlWebFormattingNone
  7.             .WebTables = """data_table"""
  8.             .WebPreFormattedTextToColumns = True
  9.             .WebConsecutiveDelimitersAsOne = True
  10.             .WebSingleBlockTextImport = False
  11.             .WebDisableDateRecognition = False
  12.             .WebDisableRedirections = False
  13.             .Refresh BackgroundQuery:=False
  14.         End With
  15.     End With
  16. End Sub
½Æ»s¥N½X
  1. Sub TEST123()
  2.     Dim YMD_day As String, N As Name, webURL As String
  3.     YMD_day = InputBox("¿é¤J ¥Á°ê¦~«×¤é´Á : 102/10/07", "¤U¸ü¯S©w¤é´Áªº¸ê®Æ", Format(Date - 1, "E/MM/DD"))
  4.     With Sheets("¤U¸ü¸ê®Æ")
  5.        For Each N In .Names
  6.             'N.Delete
  7.        Next
  8.         .Cells.Clear
  9.        GetData_URL = "URL;http://www.twse.com.tw/ch/trading/exchange/TWT93U/TWT93U.php?edition=ch&filename=genpage/A" & YMD_day & ".dat&type=csv"
  10.         'webURL = "URL; http://www.twse.com.tw/ch/trading/block/BFIAUU/BFIAUU.php?input_date=" & YMD_day & "&login_btn=¬d¸ß.dat"
  11.         With .QueryTables.Add(Connection:=GetData_URL, Destination:=.Range("A1"))
  12.             .WebSelectionType = xlSpecifiedTables
  13.             .WebFormatting = xlWebFormattingNone
  14.             .WebTables = "data_table"
  15.             .WebPreFormattedTextToColumns = True
  16.             .WebConsecutiveDelimitersAsOne = False
  17.             .WebSingleBlockTextImport = False
  18.             .WebDisableDateRecognition = False
  19.             .WebDisableRedirections = True
  20.             .Refresh BackgroundQuery:=False
  21.         End With
  22.     End With
  23. End Sub
½Æ»s¥N½X

½Ð¸Õ¥Î¤@¤U§a

Sub TWT93U()
'
'
' «H¥ÎÃB«×Á`¶qºÞ¨î¾lÃBªí  @ TWSE »OÆWÃÒ¨é¥æ©ö©Ò ¡á¥æ©ö¸ê°T ¡á¿Ä¸ê¿Ä¨é»P¥i­É¨é½æ¥XÃB«× ¡á¿Ä¨é­É¨é½æ¥X¾lÃB
' http://www.twse.com.tw/ch/trading/exchange/TWT93U/TWT93U.php
Dim YMD_day As String, N As Name, webURL As String
    YMD_day = Format(Date, "E/MM/DD")
    With Sheets("Sheet1")
        For Each N In .Names
            N.Delete
        Next
        .Cells.Clear
        webURL = "URL;http://www.twse.com.tw/ch/trading/exchange/TWT93U/TWT93U.php?input_date=" & YMD_day & "&login_btn=¬d¸ß.dat"
        With .QueryTables.Add(Connection:=webURL, Destination:=.Range("A1"))
            .WebSelectionType = xlSpecifiedTables
            .WebFormatting = xlWebFormattingNone
            .WebTables = "7,9"
            .WebPreFormattedTextToColumns = True
            .WebConsecutiveDelimitersAsOne = False
            .WebSingleBlockTextImport = False
            .WebDisableDateRecognition = False
            .WebDisableRedirections = True
            .Refresh BackgroundQuery:=False
        End With
    End With
End Sub
«Ü©êºp¡A§Ú¬O¤p¾Ç¥Í¡A¤£¯à¤U¸üÀɮסA¬O­Ó¤p§¾«Ä¡I

TOP

¦^´_ 35# gto1208
§ï¦n¤F¡A½Ð¸Õ¥Î§a¡I

    Sub TEST123()
        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"))
        With Sheets("¤U¸ü¸ê®Æ")
           For Each N In .Names
                'N.Delete
           Next
            .Cells.Clear
            GetData_URL = "URL;http://www.twse.com.tw/ch/trading/exchange/TWT93U/TWT93U.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=¬d¸ß.dat"
            With .QueryTables.Add(Connection:=GetData_URL, Destination:=.Range("A1"))
                 .WebSelectionType = xlSpecifiedTables
                 .WebFormatting = xlWebFormattingNone
                 .WebTables = "9"
                 .WebPreFormattedTextToColumns = True
                 .WebConsecutiveDelimitersAsOne = False
                 .WebSingleBlockTextImport = False
                 .WebDisableDateRecognition = False
                 .WebDisableRedirections = True
                 .Refresh BackgroundQuery:=False
             End With
            End With
        End With
    End Sub
«Ü©êºp¡A§Ú¬O¤p¾Ç¥Í¡A¤£¯à¤U¸üÀɮסA¬O­Ó¤p§¾«Ä¡I

TOP

ÁÂÁ°ª¤â  ¤Ó·PÁ¤F

TOP

heavenweaver ±z¦n

§Ú¥Ø«e¦³¤G­Óºô§}
http://www.gretai.org.tw/ch/stock/statistics/monthly/st42.php
http://www.gretai.org.tw/ch/stock/statistics/monthly/st44.php

³£¬OÄÝ©ó¤W­zªºª¬ªp¡A§Ú·Q½Ð±Ð¤@¤U¡A¬O§_¦³¤u¨ã¥i¥H¬d¸ß?edition=ch&filename=genpage/A" & YMD_day & ".dat&type=csv" --ªº°Ñ¼Æ¸ê®Æ¥X¨Ó©O¡AÁÂÁÂ

TOP

        ÀR«ä¦Û¦b : ¦n¨Æ­n´£±o°_¡A¬O«D­n©ñ±o¤U¡A¦¨´N§O¤H§Y¬O¦¨´N¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD