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

¤Ó±j¤F...§Ú¥¿¦n·Q¯}ÀY¤FT_T...¨S·Q¨ì¦³¤j¤j¤À¨É¸Ñ¨M¿ìªk^^

TOP

¦^´_ 35# GBKEE


¦pªG¥Î .responseText
«ç»ò¼g,¹F¨ì IF ...Then...ElseIF.... EndIf

TOP

¦^´_ 34# HSIEN6001
  1.   With stream   '¦b³oWith¤U
  2.                .Type = 1
  3.                 .Open
  4.                 .write xml.responseBody
  5.                 '**** §PÂ_Ū¨ú¸ê®Æ   ****************************************************************
  6.                 If .document.body.Innertext Like "*¸Ó¤éµL¥æ©ö¸ê°T*" Then
  7.                  '*******  .document ¬OIEªº¤lª«¥ó******
  8.                     GoTo NN  'Goto ¤U¤@­Ó
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 33# GBKEE


    ¥X²{°õ¦æ¶¥¬q¿ù»~'438 , ª«¥ó¤£¤ä´©¦¹ÄݩʩΤèªk
¸ò³o¤@¬q§PÂ_¦¡¦³Ãö,¤£ª¾¹D¸Ó«ç»ò§ï ?
¨S§PÂ_¤º®e,·|¤U¸ü¨ìªÅ­È
  1.                 .write xml.responseBody
  2.                 '**** §PÂ_Ū¨ú¸ê®Æ   ****************************************************************
  3.                 If .document.body.Innertext Like "*¸Ó¤éµL¥æ©ö¸ê°T*" Then
  4.                     GoTo NN  'Goto ¤U¤@­Ó
  5.                 ElseIf .document.body.Innertext Like "*ÅçÃÒ½X¿ù»~¡A½Ð­«·s¬d¸ß*" Then
  6.                      '¥N¸¹.Offset(, 2) = "NG"
  7.                      GoTo AA ''µøµ¡¤£Ãö³¬ & ­«·s¿é¤JÅçÃÒ½X & ¥N¸¹
  8.                 ElseIf .document.body.Innertext Like "*ÅçÃÒ½X¤w¹O´Á¡A½Ð­«·s¬d¸ß*" Then
  9.                     Sheets("¤U¸ü¨Ì¾Ú").Range("F:F").Delete      '²M°£ÂªºNG°O¸¹
  10.                     ¥N¸¹.Offset(, 1) = "NG"                     '¦b¹j¾À ²Ä1Äæ¦ì¼Ðµù "NG" , ¤è«K­«·s§ì¨ú®É,Á׶}¤w¸g¤U¸üªº¸ê®Æ
  11.                     .Quit   'Ãö³¬ IE µøµ¡
  12.                      GoTo AA ''µøµ¡­«·s¶}±Ò & ­«·s¿é¤JÅçÃÒ½X & ¥N¸¹
  13.                 End If
  14.                 '***** §PÂ_Ū¨ú¸ê®Æ  End *************************************************************
½Æ»s¥N½X

TOP

¦^´_ 32# HSIEN6001
  1.     '***** §PÂ_Ū¨ú¸ê®Æ  End *************************************************************
  2.             End If  '¨S¦³With ¤Ö³o End If
½Æ»s¥N½X
¦ý³oµ{¦¡©|¦³¯Ê¥¢»Ý­×§ï.

  1. Set Rng = [C:C].Find("NG", , , xlWhole)  '§ä¤£®Éªº³B¸m???
  2. For Each ¥N¸¹ In Range(Rng.Offset(0, -2), [E65536].End(xlUp)) '¶·¦b«e­±
  3.         With CreateObject("InternetExplorer.application") '¦bFor Each ¥N¸¹ °j°é¤º
  4.          
  5.          '¤Ö±¼¬d¸ß«öÁä
  6.          if ....
  7.          '³o¬q IF §PÂ_­n©ñ¦b
  8.        End If   

  9.        ¨S¦³dirÀˬd ¦sÀɤ§Àɮ׬O§_¦s¦b
  10.          .SaveToFile (path & ¥N¸¹ & ".csv")
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 29# GBKEE
±z¦n,³o¸Ì¤@ª½¥X²{¯Ê With ¤£ª¾¹D­þ¸Ì­n­×§ï
³Â·ÐÀ°¦£®Õ¥¿°ÝÃD
  1. Sub ¤U¸üCSV()
  2. Dim path As String, ¤é´Á As String, URL As String, ¥N¸¹
  3. path = "C:\myStock\"
  4. ¤é´Á = Format(Date, "emmdd")
  5. Dim Rng As Range
  6. AA:
  7.     Set Rng = [C:C].Find("NG", , , xlWhole)
  8.     Sheets("¤U¸ü¨Ì¾Ú").Activate
  9.     With CreateObject("InternetExplorer.application")
  10.         .Visible = True
  11.         .navigate "http://www.gretai.org.tw/web/stock/aftertrading/broker_trading/brokerBS.php?l=zh-tw"
  12.             Do Until .readyState = 4
  13.                 DoEvents
  14.             Loop
  15.         ÅçÃÒ½X = InputBox("¿é¤J¬d¸ßÅçÃÒ½X", "ÅçÃÒ½X", code)   'ÅçÃÒ½X = InputBox
  16.         For Each ¥N¸¹ In Range(Rng.Offset(0, -2), [E65536].End(xlUp))
  17.             .document.all("stk_code").Value = ¥N¸¹
  18.             .document.all("auth_num").Value = ÅçÃÒ½X
  19.         '**** ª½±µ¤U¸üCSV ****
  20.         Dim xml As Object
  21.         Dim stream
  22.         Set xml = CreateObject("Microsoft.XMLHTTP")
  23.         Set stream = CreateObject("ADODB.stream")
  24.             'GET http://www.gretai.org.tw/web/stock/aftertrading/broker_trading/download_ALLCSV.php?curstk=8069&stk_date=1031215&auth=ÅçÃÒ½X
  25.             URL = "http://www.gretai.org.tw/web/stock/aftertrading/broker_trading/download_ALLCSV.php?curstk=" & ¥N¸¹ & "&stk_date=" & ¤é´Á & "&auth=" & ÅçÃÒ½X
  26.                 xml.Open "GET", URL, 0
  27.                 xml.send
  28.             With stream
  29.                 .Type = 1
  30.                 .Open
  31.                 .write xml.responseBody
  32.                 '**** §PÂ_Ū¨ú¸ê®Æ   ****************************************************************
  33.                 If .document.body.Innertext Like "*¸Ó¤éµL¥æ©ö¸ê°T*" Then
  34.                     GoTo NN  'Goto ¤U¤@­Ó
  35.                 ElseIf .document.body.Innertext Like "*ÅçÃÒ½X¿ù»~¡A½Ð­«·s¬d¸ß*" Then
  36.                     Sheets("¤U¸ü¨Ì¾Ú").Range("C:C").Delete      '²M°£ÂªºNG°O¸¹
  37.                     ¥N¸¹.Offset(, 2) = "NG"                     '·s¼WÂ_ÂI
  38.                     .Quit   'Ãö³¬ IE µøµ¡
  39.                     GoTo AA
  40.                  ElseIf .document.body.Innertext Like "*ÅçÃÒ½X¤w¹O´Á¡A½Ð­«·s¬d¸ß*" Then
  41.                     Sheets("¤U¸ü¨Ì¾Ú").Range("C:C").Delete      '²M°£ÂªºNG°O¸¹
  42.                     ¥N¸¹.Offset(, 2) = "NG"                     '·s¼WÂ_ÂI
  43.                     .Quit   'Ãö³¬ IE µøµ¡
  44.                     GoTo AA
  45.                 '***** §PÂ_Ū¨ú¸ê®Æ  End *************************************************************
  46.                 .SaveToFile (path & ¥N¸¹ & ".csv")
  47.                 .Close
  48.             End With
  49. NN:
  50.     Next
  51.         .Quit   'Ãö³¬ IE µøµ¡
  52.     End With
  53.     Range("C2") = "NG"  '­«·s§@°O¸¹,¤è«K¤U¦^¤U¸ü
  54. End Sub
½Æ»s¥N½X

TOP

¦^´_ 29# GBKEE

ª©¤j Workbook open ¶×¤JCSVªº¤è¦¡ , ¦¬¤UÅo!ÁÂÁÂ~

TOP

¦^´_ 25# flask

§Ú¤w¸g¬ÝÀ´¤F,¤Ó¼F®`¤F
¯uªº«Ü§Ö!!ÁÂÁÂ

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-12-16 22:02 ½s¿è

¦^´_ 28# HSIEN6001
ÁÙ¦³ Workbooks.Open ¥i¥Î
  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.           CSV¸ü¤J
  20.             Target = ""
  21.             Application.EnableEvents = True
  22.         End If
  23.     End With
  24. End Sub

  25. Private Sub Get_Ie()
  26.     Set IE = CreateObject("InternetExplorer.Application")
  27.     With IE
  28.         .Visible = True
  29.         '¨é°Ó¶R½æÃÒ¨é¤é³øªí¬d¸ß¨t²Î¡]¤@¯ë¥æ©ö¡^
  30.         .Navigate "http://www.gretai.org.tw/web/stock/aftertrading/broker_trading/brokerBS.php?l=zh-tw"
  31.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  32.     End With
  33. End Sub

  34. Private Sub ¹Ï§Î§ó·s()
  35.     If IE Is Nothing Then Get_Ie
  36.     If Msg Then MsgBox "ÅçÃÒ¹Ï §ó·s§¹²¦"
  37.     Msg = False
  38.     With IE
  39.         .Refresh
  40.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  41.         ºô¸ô¹Ï¤ù¦sÀÉ .Document.all.tags("IMG")(0).href
  42.     End With
  43.     Sheet1.Shapes("ÅçÃÒ¹Ï").Fill.UserPicture ¹Ï§Î    '
  44. End Sub

  45. Private Sub ºô¸ô¹Ï¤ù¦sÀÉ(img As String)
  46.     Dim xml As Object     '¥Î¨Ó¨ú±oºô­¶¸ê®Æ
  47.     Dim stream            'As ADODB.stream   '¥Î¨ÓÀx¦s¤G¶i¦ìÀÉ®×
  48.     Set xml = CreateObject("Microsoft.XMLHTTP")
  49.     Set stream = CreateObject("ADODB.stream")
  50.     xml.Open "GET", img, 0
  51.     xml.send
  52.     With stream
  53.         .Open
  54.         .Type = 1
  55.         .write xml.responseBody
  56.         If Dir(¹Ï§Î) <> "" Then Kill ¹Ï§Î
  57.         .SaveToFile (¹Ï§Î)
  58.         .Close
  59.     End With
  60. End Sub

  61. Private Sub CSV¸ü¤J()
  62.     Dim e As Object, A As Object, kDate As String, S As String
  63.     Application.EnableEvents = True
  64.     If IE Is Nothing Then
  65.         ¹Ï§Î§ó·s
  66.         MsgBox "ÅçÃҹϤw§ó·s"
  67.         Exit Sub
  68.     End If
  69.     With IE
  70.         .Document.all.tags("INPUT")("stk_code").Value = Range(ÃÒ¨é¥N¸¹)
  71.         .Document.all.tags("INPUT")("auth_num").Value = Trim(Range(ÅçÃÒ½X))
  72.         Set A = .Document.all.tags("BUTTON")
  73.         For Each e In A
  74.             If Trim(e.Innertext) = "¬d¸ß" And e.ID = "" Then
  75.             e.Click
  76.             Exit For
  77.             End If
  78.         Next
  79.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  80.         If .Document.body.Innertext Like "***¸ÓªÑ²¼¸Ó¤éµL¥æ©ö¸ê°T***" Then S = "***¸ÓªÑ²¼¸Ó¤éµL¥æ©ö¸ê°T***"
  81.         If .Document.body.Innertext Like "***ÅçÃÒ½X¿ù»~¡A½Ð­«·s¬d¸ß¡C***" Then S = "***ÅçÃÒ½X¿ù»~¡A½Ð­«·s¬d¸ß¡C*** "
  82.         If S <> "" Then
  83.             'Range("a" & k + 1) = S
  84.             MsgBox S
  85.             GoTo NN
  86.         End If
  87.         kDate = Format(Date, "emmdd")
  88.         Application.DisplayAlerts = False
  89.         With Workbooks.Open("http://www.gretai.org.tw/web/stock/aftertrading/broker_trading/download_ALLCSV.php?curstk=" & Range(ÃÒ¨é¥N¸¹) & "&stk_date=" & kDate & "&&auth=" & Range(ÅçÃÒ½X))
  90.             .SaveAs "D:\" & Range(ÃÒ¨é¥N¸¹)
  91.             With .Sheets(1)
  92.                 .UsedRange.Range("G:K").SpecialCells(xlCellTypeConstants).Offset(1).Copy .Cells(.Rows.Count, 1).End(xlUp).Offset(1)
  93.                 .UsedRange.Range("G:K").Clear
  94.             End With
  95.             .Close True
  96.         End With
  97.         Application.DisplayAlerts = True
  98.         MsgBox "ÃÒ¨é¥N¸¹ : " & Range(ÃÒ¨é¥N¸¹) & " CSV ¸ü¤J§¹²¦"
  99. NN:
  100.         .Quit
  101.     End With
  102.     Set IE = Nothing
  103.     ¹Ï§Î§ó·s
  104. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ­×¦æ­nô½t­×¤ß¡AÂǨƽm¤ß¡AÀH³B¾i¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD