- ©«¤l
- 219
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 243
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows10
- ³nÅ骩¥»
- Office2016
- ¾\ŪÅv
- 20
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2012-4-18
- ³Ì«áµn¿ý
- 2022-2-7
|
¦^´_ 29# GBKEE
±z¦n,³o¸Ì¤@ª½¥X²{¯Ê With ¤£ª¾¹Dþ¸Ìnקï
³Â·ÐÀ°¦£®Õ¥¿°ÝÃD- Sub ¤U¸üCSV()
- Dim path As String, ¤é´Á As String, URL As String, ¥N¸¹
- path = "C:\myStock\"
- ¤é´Á = Format(Date, "emmdd")
- Dim Rng As Range
- AA:
- Set Rng = [C:C].Find("NG", , , xlWhole)
- Sheets("¤U¸ü¨Ì¾Ú").Activate
- 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
- ÅçÃÒ½X = InputBox("¿é¤J¬d¸ßÅçÃÒ½X", "ÅçÃÒ½X", code) 'ÅçÃÒ½X = InputBox
- For Each ¥N¸¹ In Range(Rng.Offset(0, -2), [E65536].End(xlUp))
- .document.all("stk_code").Value = ¥N¸¹
- .document.all("auth_num").Value = ÅçÃÒ½X
- '**** ª½±µ¤U¸üCSV ****
- Dim xml As Object
- Dim stream
- Set xml = CreateObject("Microsoft.XMLHTTP")
- Set stream = CreateObject("ADODB.stream")
- 'GET http://www.gretai.org.tw/web/stock/aftertrading/broker_trading/download_ALLCSV.php?curstk=8069&stk_date=1031215&auth=ÅçÃÒ½X
- URL = "http://www.gretai.org.tw/web/stock/aftertrading/broker_trading/download_ALLCSV.php?curstk=" & ¥N¸¹ & "&stk_date=" & ¤é´Á & "&auth=" & ÅçÃÒ½X
- xml.Open "GET", URL, 0
- xml.send
- With stream
- .Type = 1
- .Open
- .write xml.responseBody
- '**** §PÂ_Ū¨ú¸ê®Æ ****************************************************************
- If .document.body.Innertext Like "*¸Ó¤éµL¥æ©ö¸ê°T*" Then
- GoTo NN 'Goto ¤U¤@Ó
- ElseIf .document.body.Innertext Like "*ÅçÃÒ½X¿ù»~¡A½Ð«·s¬d¸ß*" Then
- Sheets("¤U¸ü¨Ì¾Ú").Range("C:C").Delete '²M°£ÂªºNG°O¸¹
- ¥N¸¹.Offset(, 2) = "NG" '·s¼WÂ_ÂI
- .Quit 'Ãö³¬ IE µøµ¡
- GoTo AA
- ElseIf .document.body.Innertext Like "*ÅçÃÒ½X¤w¹O´Á¡A½Ð«·s¬d¸ß*" Then
- Sheets("¤U¸ü¨Ì¾Ú").Range("C:C").Delete '²M°£ÂªºNG°O¸¹
- ¥N¸¹.Offset(, 2) = "NG" '·s¼WÂ_ÂI
- .Quit 'Ãö³¬ IE µøµ¡
- GoTo AA
- '***** §PÂ_Ū¨ú¸ê®Æ End *************************************************************
- .SaveToFile (path & ¥N¸¹ & ".csv")
- .Close
- End With
- NN:
- Next
- .Quit 'Ãö³¬ IE µøµ¡
- End With
- Range("C2") = "NG" '«·s§@°O¸¹,¤è«K¤U¦^¤U¸ü
- End Sub
½Æ»s¥N½X |
|