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

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

heavenweaver ±z¦n
§Ú¥Ø«e¦³¤G­Óºô§}
http://www.gretai.org.tw/ch/stock/statistics/monthly/st42.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ÁÂÁÂgto1208 µoªí©ó 2014-2-27 11:11

³Ìª½±µªº´N¬O¥ÎÂsÄý¾¹¥»¨­©Ò´£¨Ñªººô­¶¶}µoªÌ¤u¨ã¦pChromeªºÀˬd¤¸¯À©ÎFireFoxªºÀË´ú¤¸¯À
http://www.gretai.org.tw/ch/stock/statistics/monthly/st42.php

Request URL:http://www.gretai.org.tw/ch/stock/statistics/monthly/result_st42.php?timestamp=1393573668432
Form Data
            ajax=true&input_stock_code=3260
¨âªÌ¦X¨Ö
http://www.gretai.org.tw/ch/stock/statistics/monthly/result_st42.php?ajax=true&input_stock_code=3260

http://www.gretai.org.tw/ch/stock/statistics/monthly/st44.php

http://www.gretai.org.tw/ch/stock/statistics/monthly/result_st44.php?ajax=true&yy=2014&input_stock_code=3260
«Ü©êºp¡A§Ú¬O¤p¾Ç¥Í¡A¤£¯à¤U¸üÀɮסA¬O­Ó¤p§¾«Ä¡I

TOP

ÁÂÁÂheavenweaver¡A¤S¾Ç¨ì¤@©Û¤F

TOP

¦^´_  jak
GBKEE µoªí©ó 2013-11-17 09:42


­Y¬O§Ú·Qcopy¤U¦Cºô§}¬Y¤Ñ¡B¬Y´X®aªº¸ê®Æ¡Ahttp://stocker.com.tw/
¥i§_½Ð¤j¤j¼·¤¾À°¦£¡A¦³ªþÀÉ

©ú²Ó.rar (5.16 KB)

TOP

­Y¬O§Ú·Qcopy¤U¦Cºô§}¬Y¤Ñ¡B¬Y´X®aªº¸ê®Æ¡Ahttp://stocker.com.tw/
¥i§_½Ð¤j¤j¼·¤¾À°¦£¡A¦³ªþÀÉ
jak µoªí©ó 2014/3/6 11:38

©êºp,¨S¦³ª`·N¨ì,¤[µ¥¤F.
¸Õ¸Õ¬Ý
  1. <input type="text" name="StoNum" id="StoNum" style="width:100px" value="1101" onkeyup="findStoNum()">
  2. '<input type="text" name="datestart" id="datepicker" style="width:80px" value="2014-05-09" class="hasDatepicker">
  3. '<input type="submit" class="senddata" value="´£¥æ">
  4. Option Explicit
  5. Dim FormDLL As String, xDate As Date, Sh As Worksheet ', Msg As Boolean
  6. Sub Ie_Table()
  7.     Dim URL As String, A As Object, i As Integer, E As Range
  8.     Set_FormDLL
  9.     URL = "http://stocker.com.tw/"
  10.     xDate = Date - 1
  11.     If Weekday(xDate, vbMonday) > 5 Then
  12.         Do While Weekday(xDate, vbMonday) > 5
  13.         xDate = xDate - 1
  14.         Loop
  15.     End If
  16.     Set Sh = Sheets.Add                   'µ²ªGÅã¥Ü¦b·s¼Wªº¤u§@ªí
  17.     Sh.Name = Format(xDate, "yyyy-mm-dd") '©R¦W¬°¤é´Á
  18.     With CreateObject("InternetExplorer.Application")
  19.         .navigate URL
  20.         .Visible = True
  21.         For Each E In Sheets("¤U¸ü¥N¸¹¦W³æ").Range("A3", Sheets("¤U¸ü¥N¸¹¦W³æ").[A3].End(xlDown))
  22.             Do While .Busy Or .ReadyState <> 4:         Loop
  23.             With .document.getElementsByTagName("input")
  24.                 .Item("StoNum").Value = E
  25.                 .Item("datestart").Value = Format(xDate, "yyyy-mm-dd")
  26.                 For i = 0 To .Length - 1
  27.                     If .Item(i).Type = "submit" Then .Item(i).Click
  28.                 Next
  29.             End With
  30.         Do While .Busy Or .ReadyState <> 4:         Loop
  31.         Set A = .document.getElementsByTagName("TABLE")
  32.         Ep A(A.Length - 1).outerHTML
  33.         Next
  34.         .Quit
  35.     End With
  36.     Remove_FormDLL
  37. End Sub
  38. Sub Ep(S As String)
  39.     Dim D As New DataObject, E As Shape
  40.     'DataObject ª«¥ó ¦b¶i¦æÂà´«°Ê§@®É¡A°µ¬°®æ¦¡¤Æ¤å¦r¸ê®Æªº¼È¦s°Ï°ì¡C¨ä¤]¥i¥H¼È¦s©MÀx¦s¦b DataObject ªº¤å¦r¤ù¬q¬ÛÃöªº®æ¦¡¡C
  41.     '«Å§i Dim D As New DataObject '¶·¦b¤u¨ã-> ³]©w¤Þ¥Î¶µ¥Ø¥[¤J ·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library ,±M®× ¥[¤J¤@ªí³æ§Y¥i
  42.     With D
  43.         .SetText S
  44.         .PutInClipboard
  45.         With Sh.UsedRange
  46.             If .Rows.Count = 1 Then
  47.                 .Cells(1).Select
  48.             Else
  49.                 .Rows(.Rows.Count).Cells(2).Select
  50.             End If
  51.             Sh.PasteSpecial Format:="Unicode ¤å¦r"
  52.              With ActiveCell
  53.                 .Cells(2, 1) = "¤é´Á"
  54.                 .Cells(3, 1).Resize(.Parent.UsedRange.Rows.Count - .Cells(3, 1).Row) = Format(xDate, "mm/dd")
  55.             End With
  56.             
  57.         End With
  58.     End With
  59. End Sub
  60. Sub Set_FormDLL()   '·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library
  61.     On Error Resume Next
  62.     FormDLL = "FM20.DLL"
  63.     ThisWorkbook.VBProject.References.AddFromFile "C:\windows\system32\FM20.DLL"
  64.     '"C:\windows\system32\"¬O2003ª©ªº¸ô®|,2003¥H¤Wª©¥»»Ý­×§ï¸ô®|
  65. End Sub
  66. Sub Remove_FormDLL() '§R°£¤Þ¥Î Microsoft Forms 2.0 Object Library
  67.     Dim D As Object
  68.     For Each D In ThisWorkbook.VBProject.References
  69.         If UCase(D.fullpath) Like "*" & FormDLL Then
  70.             ThisWorkbook.VBProject.References.Remove D
  71.         End If
  72.     Next
  73. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 44# GBKEE

¤Ó¯«¤F¡A¤U¸ü¤S§Ö¤Sí¡A·PÁ¤j¤jÀ°¦£¡A
ÁÙ¦³§ì¤U¨Óªºµ²ªGAÄæ¬O"¤é´Á"¡A¦³¨S¦³¿ìªk§ï¦¨¸Ó¤½¥qªº"¥N¸¹"©O¡H

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-5-25 16:31 ½s¿è

¦^´_ 45# jak
  1. Sub Ie_Table()
  2. Ep A(A.Length - 1).outerHTML, E '­×§ï¤@¤U
  3. End Sub
½Æ»s¥N½X
  1. Sub Ep(S As String, Code As Range)
  2.     Dim D As New DataObject ', E As Shape
  3.     'DataObject ª«¥ó ¦b¶i¦æÂà´«°Ê§@®É¡A°µ¬°®æ¦¡¤Æ¤å¦r¸ê®Æªº¼È¦s°Ï°ì¡C¨ä¤]¥i¥H¼È¦s©MÀx¦s¦b DataObject ªº¤å¦r¤ù¬q¬ÛÃöªº®æ¦¡¡C
  4.     '«Å§i Dim D As New DataObject '¶·¦b¤u¨ã-> ³]©w¤Þ¥Î¶µ¥Ø¥[¤J ·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library ,±M®× ¥[¤J¤@ªí³æ§Y¥i
  5.     With D
  6.         .SetText S
  7.         .PutInClipboard
  8.         With Sh.UsedRange
  9.             If .Rows.Count = 1 Then
  10.                 .Cells(1).Select
  11.             Else
  12.                 .Rows(.Rows.Count).Cells(2).Select
  13.             End If
  14.             Sh.PasteSpecial Format:="Unicode ¤å¦r"
  15.              With ActiveCell
  16.                 .Cells(2, 1) = "¥N¸¹"
  17.                 .Cells(3, 1).Resize(.Parent.UsedRange.Rows.Count - .Cells(3, 1).Row) = Code
  18.             End With
  19.             
  20.         End With
  21.     End With
  22. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ jak ©ó 2014-5-24 19:11 ½s¿è

¦^´_ 46# GBKEE
¤j¤j¤£¦n·N«ä¡A³o»ò±ß¤~¦^¤å¡A­×§ï«á°õ¦æ¥X²{¿ù»~¡A¥i¥H½Ð¤j¤j¬Ý¤@¤U§Ú­þ¸Ì©ñ¿ù¶Ü¡H·PÁÂ
  1. Option Explicit
  2. Dim FormDLL As String, xDate As Date, Sh As Worksheet ', Msg As Boolean
  3. Sub Ie_Table()
  4.     Dim URL As String, A As Object, i As Integer, E As Range
  5.     Set_FormDLL
  6.     URL = "http://stocker.com.tw/"
  7.     xDate = Date - 1
  8.     If Weekday(xDate, vbMonday) > 5 Then
  9.         Do While Weekday(xDate, vbMonday) > 5
  10.         xDate = xDate - 1
  11.         Loop
  12.     End If
  13.     Set Sh = Sheets.Add                   'µ²ªGÅã¥Ü¦b·s¼Wªº¤u§@ªí
  14.     Sh.Name = Format(xDate, "yyyy-mm-dd") '©R¦W¬°¤é´Á
  15.     With CreateObject("InternetExplorer.Application")
  16.         .navigate URL
  17.         .Visible = True
  18.         For Each E In Sheets("¤U¸ü¥N¸¹¦W³æ").Range("A3", Sheets("¤U¸ü¥N¸¹¦W³æ").[A3].End(xlDown))
  19.             Do While .Busy Or .ReadyState <> 4:         Loop
  20.             With .document.getElementsByTagName("input")
  21.                 .Item("StoNum").Value = E
  22.                 .Item("datestart").Value = Format(xDate, "yyyy-mm-dd")
  23.                 For i = 0 To .Length - 1
  24.                     If .Item(i).Type = "submit" Then .Item(i).Click
  25.                 Next
  26.             End With
  27.         Do While .Busy Or .ReadyState <> 4:         Loop
  28.         Set A = .document.getElementsByTagName("TABLE")
  29.         Ep A(A.Length - 1).outerHTML, E '­×§ï¤@¤U
  30.         Next
  31.         .Quit
  32.     End With
  33.     Remove_FormDLL
  34. End Sub
  35. Sub Ep(S As String, Code As StdFont)
  36.     Dim D As New DataObject, E As Shape
  37.     'DataObject ª«¥ó ¦b¶i¦æÂà´«°Ê§@®É¡A°µ¬°®æ¦¡¤Æ¤å¦r¸ê®Æªº¼È¦s°Ï°ì¡C¨ä¤]¥i¥H¼È¦s©MÀx¦s¦b DataObject ªº¤å¦r¤ù¬q¬ÛÃöªº®æ¦¡¡C
  38.     '«Å§i Dim D As New DataObject '¶·¦b¤u¨ã-> ³]©w¤Þ¥Î¶µ¥Ø¥[¤J ·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library ,±M®× ¥[¤J¤@ªí³æ§Y¥i
  39.     With D
  40.         .SetText S
  41.         .PutInClipboard
  42.         With Sh.UsedRange
  43.             If .Rows.Count = 1 Then
  44.                 .Cells(1).Select
  45.             Else
  46.                 .Rows(.Rows.Count).Cells(2).Select
  47.             End If
  48.             Sh.PasteSpecial Format:="Unicode ¤å¦r"
  49.              With ActiveCell
  50.                 .Cells(2, 1) = "¥N¸¹"
  51.                 .Cells(3, 1).Resize(.Parent.UsedRange.Rows.Count - .Cells(3, 1).Row) = Code
  52.             End With
  53.             
  54.         End With
  55.     End With
  56. End Sub
  57. Sub Set_FormDLL()   '·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library
  58.     On Error Resume Next
  59.     FormDLL = "FM20.DLL"
  60.     ThisWorkbook.VBProject.References.AddFromFile "C:\windows\system32\FM20.DLL"
  61.     '"C:\windows\system32\"¬O2003ª©ªº¸ô®|,2003¥H¤Wª©¥»»Ý­×§ï¸ô®|
  62. End Sub
  63. Sub Remove_FormDLL() '§R°£¤Þ¥Î Microsoft Forms 2.0 Object Library
  64.     Dim D As Object
  65.     For Each D In ThisWorkbook.VBProject.References
  66.         If UCase(D.fullpath) Like "*" & FormDLL Then
  67.             ThisWorkbook.VBProject.References.Remove D
  68.         End If
  69.     Next
  70. End Sub
½Æ»s¥N½X

TOP

¦^´_ 47# jak
¤£¦n·N«ä,³Ìªñ±`¥Ç¿ù.46#ªºµ{¦¡½X¤w§ó·s
  1. Sub Ep(S As String, Code As Range)
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 48# GBKEE
¤j¤j«È®ð¤F¡A­n»¡¤£¦n·N«äªº¬O§Ú¡A³o¼Ë³Ò·Ð¤j¤j¡A
¥i¥H°õ¦æ¡Aµ²ªG´N¬O§Ú·Q¹³«Ü¤[ªº¼Ë¤l(«öN­ÓÆg)¡A¤Ó·PÁ¤F ~~~

TOP

        ÀR«ä¦Û¦b : «H¤ß¡B¼Ý¤O¡B«i®ð¤TªÌ¨ã³Æ¡A«h¤Ñ¤U¨S¦³°µ¤£¦¨ªº¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD