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

¦p¦ó¿é¤Jºô§}ª½±µ¤U¸üCSV

¦p¦ó¿é¤Jºô§}ª½±µ¤U¸üCSV

½Ð°Ýºô§}
http://www.twse.com.tw/ch/trading/exchange/BWIBBU/BWIBBU_d.php
http://www.otc.org.tw/web/stock/aftertrading/peratio_analysis/pera.php?l=zh-tw
¦p¦ó¦bºô§}¦C¿é¤JURLª½±µ¤U¸üCSVªºÀÉ®×   ¤£»Ý­n¥hÂI¥t¦sCSV
ÁÂÁÂ

¦^´_ 2# GBKEE
·PÁÂGBKEE¤j¤j¦Ê¦£¤¤©âªÅ¦^ÂФp§Ìªº·M°Ý
¤]¸Ñ¨M¤F§Úªº°ÝÃD  ÁÂÁ±z^^

TOP

¦^´_ 1# jerrystock
¥u§ä¨ì ­ÓªÑ¥»¯q¤ñ ªººô§}°Ñ¼Æ
http://www.otc.org.tw/web/stock/ ... ?d=103/10/07&c=

¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Const ¥»¯q¤ñ = "http://www.otc.org.tw/web/stock/aftertrading/peratio_analysis/pera.php"
  3. Const ¥»¯q¤ñdownload = "http://www.otc.org.tw/web/stock/aftertrading/peratio_analysis/pera_download.php?d="
  4. Dim xDate As Date, Stk As String
  5. Private Sub ­ÓªÑ¥»¯q¤ñ_´Þ§Q²v¤ÎªÑ»ù²b­È¤ñ_¨Ì¤é´Á¬d¸ß()
  6.     Dim s As String, E As Variant, A
  7.     xDate = Date - 1
  8.     Do Until Weekday(xDate, vbFriday) < 6
  9.         xDate = xDate - 1
  10.     Loop
  11.     With CreateObject("InternetExplorer.Application")
  12.         .Visible = True
  13.        .Navigate ¥»¯q¤ñ
  14.         Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  15.         With .document
  16.             '¸ê®Æ¤é´Á¡G<input id="input_date" name="input_date" class="input-date ui-corner-all" onchange="query()" maxlength="6">
  17.             .ALL("input_date").Value = Format(xDate, "E/MM/DD")  '
  18.             'D = .ALL("input_date").Value
  19.             '²£·~Ãþ§O¡G<select id="stk_category" class="input-stk-cat ui-corner-all" onchange="query()">
  20.             .ALL("stk_category").Item(0).Selected = True '¥þ³¡
  21.             '.ALL("stk_category").Item(8).Selected = True '²Ä 9(0 -> 8) ¶µ
  22.             Stk = .ALL("stk_category").Value
  23.            ' .ALL("stk_category").fireEvent ("onchange")
  24.             With .ALL("stk_category")
  25.                 For E = 0 To .Length - 1
  26.                     If .Item(E).Value = .Value Then Stk = .Item(E).Value & " " & .Item(E).INNERTEXT
  27.                     s = IIf(s = "", .Item(E).Value & " " & .Item(E).INNERTEXT, s & vbLf & .Item(E).Value & " " & .Item(E).INNERTEXT)
  28.                 Next
  29.             End With
  30.         End With
  31.         MsgBox "§A¿ï¾Ü:  " & Stk & vbLf & vbLf & s, , "²£·~Ãþ§O"
  32.         .Quit
  33.     End With
  34.     ¸ü¤JCSV
  35. End Sub
  36. Private Sub ¸ü¤JCSV()
  37.     Dim xml As Object     '¥Î¨Ó¨ú±oºô­¶¸ê®Æ
  38.     Dim stream            '¥Î¨ÓÀx¦s¤G¶i¦ìÀÉ®×
  39.     Dim URL As String     '¥Øªººô§}
  40.     Dim xPath As String, xfile As String, W As Workbook
  41.     xPath = "d:\"         '«ü©w¦sÀɸô®|
  42.     xfile = xPath & Replace(Format(xDate, "E/MM/DD"), "/", "_") & " " & Split(Stk, " ")(1) & ".csv"
  43.     For Each W In Workbooks
  44.         If UCase(W.FullName) = UCase(xfile) Then W.Close: Exit For
  45.     Next
  46.     Set xml = CreateObject("Microsoft.XMLHTTP")
  47.     Set stream = CreateObject("ADODB.stream")
  48.     URL = ¥»¯q¤ñdownload & Format(xDate, "E/MM/DD") & "&c=" & Split(Stk, " ")(0)
  49.         xml.Open "POST", URL, 0
  50.         xml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  51.         xml.send
  52.     With stream
  53.         .Open
  54.         .Type = 1
  55.         .write xml.ResponseBody
  56.         If Dir(xfile) <> "" Then Kill xfile
  57.         .SaveToFile (xfile)
  58.         .Close
  59.     End With
  60.     With Workbooks.Open(xfile).Sheets(1)
  61.         If .Range("A5") = "¦@0µ§" Then
  62.             .Parent.Close
  63.             Kill xfile
  64.             MsgBox xDate & " - " & Stk & " ¨S¦³¸ê®Æ"
  65.         Else
  66.             MsgBox xDate & " - " & Stk & Space(5) & .Cells(1).End(xlDown) & "¸ê®Æ"
  67.         End If
  68.     End With
  69. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : «Ý¤H°h¤@¨B¡A·R¤H¼e¤@¤o¡A´N·|¬¡±o«Ü§Ö¼Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD