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

½Ð°Ý¦p¦ó±Nºô­¶ªº¹Ï¤ù¦sÀÉ

½Ð°Ý¦p¦ó±Nºô­¶ªº¹Ï¤ù¦sÀÉ

With CreateObject("InternetExplorer.application")           
        .Visible = True                                       
        .Navigate "http://www.gretai.org.tw/web/stock/aftertrading/broker_trading/brokerBS.php?l=zh-tw"
      
        Do Until .ReadyState = 4               
            DoEvents
        Loop
Set img = .document.all.tags("img")(0)
end with
½Ð°Ý§Ú¦p¦ó§âimg³o­Ó¹Ï¦s¦¨c:\2.png

¦^´_ 1# flask
³ÌªñªÑ²¼¤½¶}ºô­¶¸ê°Tªº¤U¸ü,³£¦³ÅçÃÒ½X¨¾¤î¦Û°Ê¤U¸ü.
¥Ñ©óÅçÃÒ½X¤£¦n¯}¸Ñ,¥i¸Õ¸Õ¥b¦Û°Ê¤U¸ü
1½Ð¦b¤u§@ªí¤W´¡¤J¤@¹Ï¤ù(©R¦W:ÅçÃÒ¹Ï)
2¹Ï¤ù¥¨¶°«ü©w¬° ,Sheet1.¹Ï§Î§ó·s,³oµ{¦¡

¬°¨ÏVBA¤JªùªÌ,¦³¹ê§@¸gÅç,¬G¶Èªþ¤Wµ{¦¡½X.



ThisWorkbook¼Ò²Õªºµ{¦¡½X
  1. Option Explicit
  2. Private Sub Workbook_Open()
  3.     Sheet1.Msg = True
  4.     Run "Sheet1.¹Ï§Î§ó·s"
  5. End Sub
  6. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  7.     On Error Resume Next
  8.     If Not Sheet1.IE Is Nothing Then Sheet1.IE.Quit
  9. End Sub
½Æ»s¥N½X
Sheet1¼Ò²Õªºµ{¦¡½X
  1. Option Explicit
  2. Public IE As Object, Msg As Boolean
  3. Const ¹Ï§Î = "d:\ÅçÃÒ¹Ï.jpg"
  4. Const ÃÒ¨é¥N¸¹ = "F2"
  5. Const ÅçÃÒ½X = "F4"
  6. Private Sub Worksheet_Change(ByVal Target As Range)
  7.     Range(ÃÒ¨é¥N¸¹).Interior.ColorIndex = IIf(Range(ÃÒ¨é¥N¸¹).Value = "", 2, 36)
  8.     With Target.Cells(1)
  9.          If .Address(0, 0) = ÅçÃÒ½X Then .Interior.ColorIndex = IIf(Len(Trim(.Cells)) = 5, 36, 2)
  10.          If .Address(0, 0) = ÅçÃÒ½X And Len(Trim(.Cells)) = 5 And Range(ÃÒ¨é¥N¸¹).Value <> "" Then
  11.             If IE Is Nothing Then
  12.                 Target = ""
  13.                 Msg = True
  14.                 ¹Ï§Î§ó·s
  15.                 Exit Sub
  16.             End If
  17.             Application.EnableEvents = False
  18.             ¤é³øªí¸ü¤J
  19.             Target = ""
  20.             Application.EnableEvents = True
  21.         End If
  22.     End With
  23. End Sub
  24. Private Sub ¤é³øªí¸ü¤J()
  25.     Dim e As Object, a As Object, K  As Integer, i As Integer, ii As Integer, s As String
  26.     If IE Is Nothing Then
  27.         ¹Ï§Î§ó·s
  28.         MsgBox "ÅçÃҹϤw§ó·s"
  29.         Exit Sub
  30.     End If
  31.     With IE
  32.         .Document.ALL.tags("INPUT")("stk_code").Value = Range(ÃÒ¨é¥N¸¹)
  33.         .Document.ALL.tags("INPUT")("auth_num").Value = Trim(Range(ÅçÃÒ½X))
  34.         Set a = .Document.ALL.tags("BUTTON")
  35.         For Each e In a
  36.             If Trim(e.innertext) = "¬d¸ß" And e.ID = "" Then
  37.             e.Click
  38.             Exit For
  39.             End If
  40.         Next
  41.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  42.         K = 6
  43.         UsedRange.Offset(6).Clear
  44.         If .Document.body.innertext Like "***¸ÓªÑ²¼¸Ó¤éµL¥æ©ö¸ê°T***" Then s = "***¸ÓªÑ²¼¸Ó¤éµL¥æ©ö¸ê°T***"
  45.         If .Document.body.innertext Like "***ÅçÃÒ½X¿ù»~¡A½Ð­«·s¬d¸ß¡C***" Then s = "***ÅçÃÒ½X¿ù»~¡A½Ð­«·s¬d¸ß¡C*** "
  46.         If s <> "" Then
  47.             Range("a" & K + 1) = s
  48.             MsgBox s
  49.             GoTo NN
  50.         End If
  51.         Set a = .Document.ALL.tags("table")(0)
  52.         For i = 0 To a.Rows.Length - 1
  53.             K = K + 1
  54.             For ii = 0 To a.Rows(i).Cells.Length - 1
  55.                 Cells(K, ii + 1) = a.Rows(i).Cells(ii).innertext
  56.             Next
  57.         Next
  58.         Set a = .Document.ALL.tags("table")(2)
  59.         K = K + 1
  60.         For i = 0 To a.Rows.Length - 1
  61.             K = K + 1
  62.             For ii = 0 To a.Rows(i).Cells.Length - 1
  63.                 Cells(K, ii + 1) = a.Rows(i).Cells(ii).innertext
  64.             Next
  65.         Next
  66.         Set a = .Document.ALL.tags("table")(3)
  67.         For i = 1 To a.Rows.Length - 1
  68.             K = K + 1
  69.             For ii = 0 To a.Rows(i).Cells.Length - 1
  70.                 Cells(K, ii + 1) = a.Rows(i).Cells(ii).innertext
  71.             Next
  72.         Next
  73.         MsgBox Range("d7") & " ¤é³øªí¸ü¤J §¹²¦!!"
  74. NN:
  75.         .Quit
  76.     End With
  77.     Set IE = Nothing
  78.     ¹Ï§Î§ó·s
  79. End Sub
  80. Private Sub Get_Ie()
  81.     Set IE = CreateObject("InternetExplorer.Application")
  82.     With IE
  83.        ' .Visible = True
  84.         '¨é°Ó¶R½æÃÒ¨é¤é³øªí¬d¸ß¨t²Î¡]¤@¯ë¥æ©ö¡^
  85.         .Navigate "http://www.gretai.org.tw/web/stock/aftertrading/broker_trading/brokerBS.php?l=zh-tw"
  86.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  87.     End With
  88. End Sub
  89. Private Sub ¹Ï§Î§ó·s()
  90.     If IE Is Nothing Then Get_Ie
  91.     If Msg Then MsgBox "ÅçÃÒ¹Ï §ó·s§¹²¦"
  92.     Msg = False
  93.     With IE
  94.         .Refresh
  95.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  96.         ºô¸ô¹Ï¤ù¦sÀÉ .Document.ALL.tags("IMG")(0).href
  97.     End With
  98.     Sheet1.Shapes("ÅçÃÒ¹Ï").Fill.UserPicture ¹Ï§Î    '
  99. End Sub
  100. Private Sub ºô¸ô¹Ï¤ù¦sÀÉ(img As String)
  101.     Dim xml As Object     '¥Î¨Ó¨ú±oºô­¶¸ê®Æ
  102.     Dim stream            'As ADODB.stream   '¥Î¨ÓÀx¦s¤G¶i¦ìÀÉ®×
  103.     Set xml = CreateObject("Microsoft.XMLHTTP")
  104.     Set stream = CreateObject("ADODB.stream")
  105.     xml.Open "GET", img, 0
  106.     xml.send
  107.     With stream
  108.         .Open
  109.         .Type = 1
  110.         .write xml.ResponseBody
  111.         If Dir(¹Ï§Î) <> "" Then Kill ¹Ï§Î
  112.         .SaveToFile (¹Ï§Î)
  113.         .Close
  114.     End With
  115. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

·PÁÂGBKEE¤j¤jªº¦^µª!
Private Sub ºô¸ô¹Ï¤ù¦sÀÉ(img As String)
    Dim xml As Object     '¥Î¨Ó¨ú±oºô­¶¸ê®Æ
    Dim stream            'As ADODB.stream   '¥Î¨ÓÀx¦s¤G¶i¦ìÀÉ®×
    Set xml = CreateObject("Microsoft.XMLHTTP")
    Set stream = CreateObject("ADODB.stream")
    xml.Open "GET", img, 0
    xml.send
    With stream
        .Open
        .Type = 1
        .write xml.ResponseBody
        If Dir(¹Ï§Î) <> "" Then Kill ¹Ï§Î
        .SaveToFile (¹Ï§Î)
        .Close
    End With
End Sub
¥H³o¤è¦¡¤U¸üªº¹Ï¤ù»PIE­¶­±ªº¹Ï¤£¬O¬Û¦Pªº¹Ï
­n¦p¦ó¤U¸ü¦^¨Óªº¬OIE­¶­±ªº¹Ï,¦]¬°¥¦¬OPNGÀÉ
§Ú¸Õ¤F´XºØ¤è¦¡³£¨S¿ìªk¬OIE­¶­±ªº¹Ï,ÅçÃÒ½Xªº
¹Ï­nÂনBMP®æ¦¡¤~¯à°µ2­È¤Æªº³B²z.¦pªG¤£¬OPNG
Àɪº¸Ü¥ÎGetClipboardData´N¥i¥H³B²z¤F!¤@ª½·Q
¯}ÀY­Ó¤Hªº¥\¤O¹ê¦b¤Ó²L¤FÁÙ¦b¾Ç²ß¤¤!§Æ±æ¦Ñ®v
¯à´£ÂI¤@¤U!

TOP

´ú¸Õ§¹µo²{ÅçÃÒ½X¿é¤J­¶­±¤Wªº½X»P¦sÀɹϤWªº½X³£¬OOKªº??

TOP

¤U¸üªº¹Ï¤ù»PIE­¶­±ªº¹Ï¤£¬O¬Û¦Pªº¹Ï
¾É¤J³£·|"ÅçÃÒ½X¤w¹O´Á¡A½Ð­«·s¬d¸ß"
¥¢±Ñ!¦p¦ó§ì¤U¨Ó¹Ï¬Oie­¶­±Åã¥Üªº¹Ï¤ù«¨?

TOP

¦^´_ 5# flask
µ{¦¡°õ¦æ¦p¹Ï



   
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

­ì¨Ó¬OÅçÃÒ½Xtessdata-OCRµø§O¿ù»~!

TOP

¦^´_ 6# GBKEE
½Ð°Ý ª©¤j³o¬O¨º¸Ì¥X¿ù
ÁÂÁÂ

2014-12-13_114055.jpg (98.46 KB)

2014-12-13_114055.jpg

¬¡­¶Ã¯1.rar (15.6 KB)

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-12-13 13:24 ½s¿è

¦^´_ 8# wufonna
³o¿ù»~¬O§A±N IEÃö³¬¤F
VBA«ö¤U­«³],­«·s°õ¦æµ{¦¡
  1. Private Sub Get_Ie()
  2.     Set IE = CreateObject("InternetExplorer.Application")
  3.     With IE
  4.        ' .Visible = True  *** ¤£Åã¥Ü´N¬O¨¾¤î¨Ï¥ÎªÌÃö³¬IE
  5.         '¨é°Ó¶R½æÃÒ¨é¤é³øªí¬d¸ß¨t²Î¡]¤@¯ë¥æ©ö¡^
  6.         .Navigate "http://www.gretai.org.tw/web/stock/aftertrading/broker_trading/brokerBS.php?l=zh-tw"
  7.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  8.     End With
  9. End Sub
½Æ»s¥N½X


´¡¤Jªº¹Ï¤ù»Ý¨Ï¥Îø¹Ïªº¹Ï¤ù
  1. ¤u§@ªí1.Shapes("ÅçÃÒ¹Ï").Fill.UserPicture ¹Ï§Î
½Æ»s¥N½X
ªþÀÉ´¡¤Jªº¹Ï¤ù¨S§ï¦WºÙ ÅçÃÒ¹Ï
¤]¥i¥H¨Ï¥Î Shapes(¯Á¤Þ­È)->¦pShapes(1)
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 9# GBKEE

GBKEE ¤j
°õ¦æ¦³¶}±ÒIE
¿ù맽X¦p¤U¡AÁÙ¬O§Ú¦³¨º¤@¨B°µ¤F¡AÁÂÁÂ

Àɦw¦P©ñD:\ ®Ú¥Ø¤U

2014-12-13_143120.jpg (111.53 KB)

2014-12-13_143120.jpg

2014-12-13_143151.jpg (36.57 KB)

2014-12-13_143151.jpg

¬¡­¶Ã¯1.rar (23.84 KB)

TOP

        ÀR«ä¦Û¦b : ®É®É¦n¤ß´N¬O®É®É¦n¤é¡C
ªð¦^¦Cªí ¤W¤@¥DÃD