ªð¦^¦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

¦^´_  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

¦^´_ 44# GBKEE

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

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

¦^´_ 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 : ¬°¦Û¤v§äÂǤfªº¤H¥Ã»·¤£·|¶i¨B¡C
ªð¦^¦Cªí ¤W¤@¥DÃD