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

¥æ©ö©ú²Ó¤U¸ü

¥æ©ö©ú²Ó¤U¸ü

http://bsr.twse.com.tw/bshtm/

³o­Óºô¯¸¤ñ¸û¦³¤H©Ê¤@ÂI  °Ñ¼Æ§äªº¨ì¤]¥i¥H³]©w

¦ý¬O§Ú¤£ª¾¹D­¶¼Æ¦³´X±i

¤gªk·Ò¿û¤@­¶¤@­¶§Ë¤]«Ü¨S¦³®Ä²v

¬d¸ß¤Ó¦h¦¸ÁÙ·|³QÀÉ

½Ð°Ýµ{¦¡¸Ó¦p¦ó¤U¸ü
  1. Sub ­ÓªÑ¥æ©ö©ú²Ó¤U¸ü()
  2.     Dim ªÑ²¼¥N¸¹ As String, ¤é´Á As Variant, N, i As Integer, A, T As Date
  3.     Do While Not IsDate(¤é´Á)
  4.         ¤é´Á = InputBox("¿é¤J¬d¸ß¤é´Á", "¤é´Á", Date)
  5.         If ¤é´Á = "" Then End
  6.     Loop
  7.     Do While ªÑ²¼¥N¸¹ = ""
  8.         ªÑ²¼¥N¸¹ = InputBox("ªÑ²¼¥N¸¹", "¿é¤J¬d¸ß¤§ªÑ²¼¥N¸¹", "1101")
  9.         If ¤é´Á = "" Then End
  10.     Loop
  11.     ¤é´Á = Format(¤é´Á, "yyyymmdd")
  12.     T = Time
  13.     With ActiveSheet
  14.         For Each N In .Names
  15.             N.Delete
  16.         Next
  17.         .Cells.Clear
  18.         Application.StatusBar = False
  19.         On Error GoTo A_Wait
  20.         With .QueryTables.Add(Connection:="URL;http://bsr.twse.com.tw/bshtm/bshtm_report_Messages.aspx?strDate=" & ¤é´Á & "&StartNumber=" & ªÑ²¼¥N¸¹ & "&FocusIndex=1", Destination:=Range("A1"))
  21.             .Name = ¤é´Á & "_" & ªÑ²¼¥N¸¹ & "_1"
  22.             .FieldNames = True
  23.             .RowNumbers = False
  24.             .FillAdjacentFormulas = False
  25.             .PreserveFormatting = True
  26.             .RefreshOnFileOpen = False
  27.             .BackgroundQuery = True
  28.             .RefreshStyle = xlInsertDeleteCells
  29.             .SavePassword = False
  30.             .SaveData = True
  31.             .AdjustColumnWidth = True
  32.             .RefreshPeriod = 0
  33.             .WebSelectionType = xlEntirePage
  34.             .WebFormatting = xlWebFormattingNone
  35.             .WebPreFormattedTextToColumns = True
  36.             .WebConsecutiveDelimitersAsOne = True
  37.             .WebSingleBlockTextImport = False
  38.             .WebDisableDateRecognition = False
  39.             .WebDisableRedirections = False
  40.             .Refresh BackgroundQuery:=False
  41.             If Application.CountA(.ResultRange) = 0 Then
  42.                 MsgBox Format(¤é´Á, "0000/00/00") & " ¥ð¥«!!!  ©Î  ªÑ²¼¥N¸¹:" & ªÑ²¼¥N¸¹ & " ¿ù»~ !!!"
  43.                 [A1].Select
  44.                 End
  45.             End If
  46.         End With
  47.         i = 2
  48.         Do
  49.             .Cells(Rows.Count, 1).End(xlUp).Offset(1).Select
  50.             With .QueryTables.Add(Connection:="URL;http://bsr.twse.com.tw/bshtm/bshtm_report_Messages.aspx?strDate=" & ¤é´Á & "&StartNumber=" & ªÑ²¼¥N¸¹ & "&FocusIndex=" & i, Destination:=Selection)
  51.                 .Name = ¤é´Á & "_" & ªÑ²¼¥N¸¹ & "_" & i
  52.                 .WebSelectionType = xlSpecifiedTables
  53.                 .WebFormatting = xlWebFormattingNone
  54.                 .WebTables = "6"
  55.                 .WebPreFormattedTextToColumns = True
  56.                 .WebConsecutiveDelimitersAsOne = True
  57.                 .WebSingleBlockTextImport = False
  58.                 .WebDisableDateRecognition = False
  59.                 .WebDisableRedirections = False
  60.               ''''''µLªk¬d¸ß®Éµy«Ý  ¨ì  A_Wait: '''''
  61.                 .Refresh BackgroundQuery:=False
  62.                 If Application.CountA(.ResultRange) = 0 Then GoTo Out
  63.                 i = i + 1
  64.             End With
  65.             A = CreateObject("WScript.Shell").popup("½Ðµ¥«á¤U¸ü..." & Chr(10) & Chr(10) & "** ½Ð¤Å«ö¤U ** [½T©w]", 4, ¤é´Á & "_" & .[F2] & "  ²Ä" & i & "­¶", 16 * 3 + 0)
  66.             Application.ScreenUpdating = True
  67.         Loop
  68. Out:
  69.         .UsedRange.Columns.AutoFit
  70.         .[A1].Select
  71.         A = CreateObject("WScript.Shell").popup("¦@¤U¸ü" & i & "­¶", 5, ¤é´Á & "_" & ªÑ²¼¥N¸¹, 48 + 0)
  72.         Application.StatusBar = "¦@¤U¸ü " & i & "­¶ ¶O®É " & Format(Time - T, "HH:MM:SS")
  73.     End With
  74.     End
  75. A_Wait:
  76.     Application.StatusBar = "µLªk¬d¸ßµ¥­Ô10¬íÄÁ"
  77.     Application.Wait Now + TimeValue("00:00:10")
  78.     Err.Clear
  79.     Application.StatusBar = False
  80.     Resume    '­«ªð¬d¸ß
  81. End Sub
½Æ»s¥N½X
¥H«e¥i¥H¤U¸ü¨ì...²{¦b¤U¤£¨ì¡A½Ð¨D°ª¤â¸Ñ´b

¦^´_ 1# a2305577


    http://forum.twbts.com/viewthrea ... amp;from=indexheats
  §ä³o­Óª©¥D°Ý§a!!

TOP

¦^´_ 2# chen_cook


    ÁÂÁ¡I­ì¨Ó°ÝÃD¤w¦³¤H¥ýµo²{

    ÀR«Ý°ª¤â¸Ñ¨M

TOP

http://bsr.twse.com.tw/bshtm/

³o­Óºô¯¸¤ñ¸û¦³¤H©Ê¤@ÂI  °Ñ¼Æ§äªº¨ì¤]¥i¥H³]©w

¦ý¬O§Ú¤£ª¾¹D­¶¼Æ¦³´X ...
a2305577 µoªí©ó 2012-7-31 05:28


¶Ù~
­è¬Ý¤F¤@¤U
¥D­n´N¬O¥Lªººô§}¤w¸gÀqÀq¦a§ï¤F= ="
·sªº¬O: http://bsr.twse.com.tw/bshtm/bsContent.aspx?StartNumber=1101&FocusIndex=1
©Ò»Ý°Ñ¼Æ¥u¦³ªÑ²¼¥N½X¦Ó¤w
³o¼Ë°ÝÃDÀ³¸Ó´N¸Ñ¨M¤F§a:)

TOP

¦^´_ 4# lalalada

³o¼Ë´NµLªk¤@¦¸¦Û°Ê¤U¸ü¤F¡I¬O¶Ü

TOP

¦^´_ 4# lalalada

¥i§_À°¦£«á­±¨º­Ó­¶½X, ¦p¦ó¨ú±o ?
http://bsr.twse.com.tw/bshtm/bsContent.aspx?StartNumber=1101&FocusIndex=all_
manny

TOP

¦^´_ 4# lalalada


    §A³o¼Ë¬O²Ä1­¶¡A¥Lªº°ÝÃD¬O­nª¾¹D¦³´X­¶³á

TOP

¥»©«³Ì«á¥Ñ lalalada ©ó 2012-8-1 11:00 ½s¿è

³á³á ¤£¦n·N«ä
¤§«e§Ú¥H¬°¦¨¥\¤F µ²ªG¶]§¹¤§«áµo²{¸ê®Æ¬O¿ùªº...
³o¬O§Ú¤§«e¼gªº:
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
    With WinHttpReq
    .Open "POST", URL, False
    .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    .Send (varBody)
           Set oStream = CreateObject("ADODB.Stream")
           oStream.Open
           oStream.Type = 1
           oStream.Write WinHttpReq.ResponseBody
           oStream.SaveToFile ("C:\AA\temp\" & CStr(code) & ".csv")
           oStream.Close
    End With
Application.Workbooks.Open ("C:\AA\temp\" & CStr(code) & ".csv")
Cells.Find(what:="sp_list").Activate
Page = Left(ActiveCell, a, b)
´N¦p¤§«e©Ò»¡ ¬O±Nºô­¶­ì©lÀɧì¤U¨Ó¦AŪ¨ú
µo²{«á´N¶}©l­×§ï µ¥¯uªº§Ë¦n¦Apo§¹¾ãª©
³o´X¤Ñ¥u¯àÄ~Äò¥ÎGª©¤j¤§«e¼gªº¤gªk·Ò¿û§ì¦³¿³½ìªºªÑ²¼ ʨ
¥Ø«e¥i¯à­n½Ð±Ð¥ÎPYTHONªº¨º¦ìÅo ¬Ý°_¨Ó¦n¹³¥i¥H§ì¦¨csvÀÉ(?)
¤£¹L¥L¦ü¥G±Mª`©ó¶}·sª©¦Ó¨S¦³­nPOµ{¦¡½Xªº·N«ä
©Ò¥H³Ìªñ¤]­n¶}©l¾Ç¤F~

TOP

¦^´_ 6# mannyhsu
  1. Option Explicit
  2. Sub ­ÓªÑ¥æ©ö©ú²Ó¤U¸ü()
  3.     Dim ªÑ²¼¥N¸¹ As String, ¤é´Á As Variant, N As Name, i As Integer, T As Date, A
  4.     Do While Not IsDate(¤é´Á)
  5.         ¤é´Á = InputBox("¿é¤J¬d¸ß¤é´Á", "¤é´Á", Date)
  6.         If ¤é´Á = "" Then End
  7.     Loop
  8.     Do While ªÑ²¼¥N¸¹ = ""
  9.         ªÑ²¼¥N¸¹ = InputBox("ªÑ²¼¥N¸¹", "¿é¤J¬d¸ß¤§ªÑ²¼¥N¸¹", "1101")
  10.         If ¤é´Á = "" Then End
  11.     Loop
  12.     ¤é´Á = Format(¤é´Á, "yyyymmdd")
  13.     T = Time
  14.     With ActiveSheet
  15.         .Cells.Clear
  16.         DoEvents
  17.         Application.ScreenUpdating = False
  18.         Application.StatusBar = False
  19.         With .QueryTables.Add(Connection:="URL;http://bsr.twse.com.tw/bshtm/bsContent.aspx?strDate=" & ¤é´Á & "&StartNumber=" & ªÑ²¼¥N¸¹ & "&FocusIndex=1", Destination:=Range("A1"))
  20.             .BackgroundQuery = True
  21.              .WebTables = "6,7"
  22.             .Refresh BackgroundQuery:=False
  23.              .ResultRange(1).End(xlDown).Offset(2).CurrentRegion.Cut .ResultRange(1).End(xlToRight).Offset(, 1)
  24.             If Application.CountA(.ResultRange) = 0 Then
  25.                 MsgBox Format(¤é´Á, "0000/00/00") & " ¥ð¥«!!!  ©Î  ªÑ²¼¥N¸¹:" & ªÑ²¼¥N¸¹ & " ¿ù»~ !!!"
  26.                 [A1].Select
  27.                 End
  28.             End If
  29.             ActiveSheet.Names(.Name).Delete
  30.         End With
  31.         i = 2
  32.         Do
  33.             .Cells(.Rows.Count, 1).End(xlUp).Offset(1).Select
  34.             With .QueryTables.Add(Connection:="URL;http://bsr.twse.com.tw/bshtm/bsContent.aspx?strDate=" & ¤é´Á & "&StartNumber=" & ªÑ²¼¥N¸¹ & "&FocusIndex=" & i, Destination:=Selection)
  35.                 .BackgroundQuery = True
  36.                 .WebTables = "6,7"
  37.                 On Error Resume Next
  38.                 Do
  39.                      Err.Clear
  40.                 .Refresh BackgroundQuery:=False
  41.                 Loop Until Err.Number = 0
  42.                 On Error GoTo 0
  43.                 If Application.CountA(.ResultRange) = 0 Then GoTo OUT
  44.                 .ResultRange(1).End(xlDown).Offset(2).CurrentRegion.Cut .ResultRange(1).End(xlToRight).Offset(, 1)
  45.                 .ResultRange(1).EntireRow.Delete
  46.                 ActiveSheet.Names(.Name).Delete
  47.                 i = i + 1
  48.             End With
  49.         Loop
  50. OUT:
  51.         .[A1].Select
  52.         Application.ScreenUpdating = True
  53.         With .UsedRange
  54.             .WrapText = False
  55.             .Interior.ColorIndex = xlNone
  56.             .Font.Size = 12
  57.             .Columns.AutoFit
  58.             A = CreateObject("WScript.Shell").popup("¦@¤U¸ü " & i & " ­¶¶O®É  " & Format(Time - T, "hh:mm¤ÀSS¬í"), 5, ¤é´Á & "_" & ªÑ²¼¥N¸¹, 48 + 0)
  59.             Application.StatusBar = ¤é´Á & " _ " & ªÑ²¼¥N¸¹ & " ¦@¤U¸ü " & i & "­¶ ¶O®É " & Format(Time - T, "HH:MM:SS")
  60.         End With
  61.         For Each N In .Names
  62.             N.Delete
  63.         Next
  64.      End With
  65. End Sub
½Æ»s¥N½X

TOP

¦^´_ 9# GBKEE

yap ´N¬O³o­Ó
¥t¥~´£¨Ñ¤@¤p¬qµ{¦¡½X
¥i¥H§K¥h¤â°Ê¿é¤J¤é´Á
¤Ï¥¿¥L¤]¥u¦³¤@¤Ñªº¸ê®Æ¥i¥H¤U¸ü
Sheets.Add
With ActiveSheet.QueryTables.Add(Connection:="URL;http://bsr.twse.com.tw/bshtm/bsContent.aspx?StartNumber=1101&FocusIndex=All_1", Destination:=Range("A1"))
        .PreserveFormatting = True
        .RefreshStyle = xlInsertDeleteCells
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "4,""table2"""
        .Refresh BackgroundQuery:=False
        End With
dataDate = Format(Cells(1, 2), "yyyymmdd")

TOP

        ÀR«ä¦Û¦b : ¬°¦Û¤v§äÂǤfªº¤H¥Ã»·¤£·|¶i¨B¡C
ªð¦^¦Cªí ¤W¤@¥DÃD