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

[µo°Ý] ²{¦b­n¦p¦ó¨ìÃÒ¥æ©Ò¤U¸ü¥~¸ê¦¨¥æ¸ê°T

[µo°Ý] ²{¦b­n¦p¦ó¨ìÃÒ¥æ©Ò¤U¸ü¥~¸ê¦¨¥æ¸ê°T

¤§«e¬O¥Î¤U¦Cªºµ{¦¡½X ¨ì http://www.twse.com.tw/ch/trading/fund/TWT38U/TWT38U.php ³oÃä¥h¤U¸ü¨C¤é¥~¸ê¶R½æ¶W¸ê°T¡C
­ì¥»³£¨S¦³°ÝÃD¡A¦ý¤@¤ë¥÷ ÃÒ¥æ©Ò§ïºô­¶¡A­ì¥»¥i¥H¬Ý¨ì¤@­Ó¤U¸ü¸ô®|¡A¦ý²{¦b¨S¿ìªk¬Ý¨ì¡A¾É­P¤£ª¾¹D¸Ó¦p¦ó¤U¸ü¨C¤éªº CSV ÀÉ...

¦³¨S¦³¤Hª¾¹D¸Ó¦p¦ó¤U¸ü¡H

Dim st
Dim myURL As String
Dim oStream As Object           'ADODB.Stream
Dim WinHttpReq As Object            'XMLHTTP
Dim fileidx As String
Dim seldate As String

Worksheets("Config").Select
endline = Range("A65536").End(xlUp).Row


    seldate = Range("A" & i).Value    ''¦¨¥æ¤é´Á
    fileidx = seldate
   
    ''http://www.twse.com.tw/ch/trading/fund/TWT38U/TWT38U_print.php?edition=ch&filename=genpage/A20141202.dat&type=csv
   
    myURL = "http://www.twse.com.tw/ch/trading/fund/TWT38U/TWT38U_print.php?edition=ch&filename=genpage/A" & _
            fileidx & ".dat&type=csv"
         
    ''¥~¸ê¶R½æ¸ê°T
    Set WinHttpReq = CreateObject("MSXML2.XMLHTTP")
    With WinHttpReq
        .Open "GET", myURL, False
        .Send
        myURL = .responseText
    End With
    Set oStream = CreateObject("ADODB.Stream")
    With oStream
        .Open
        .Type = 1
        .Write WinHttpReq.responseBody
        fileidx = Sheets("Config").Range("G2") & "\A" & fileidx & ".csv"          ''³]©w¤U¸ü¸ô®|¤ÎÀɦW
        On Error Resume Next
        Kill fileidx
        On Error GoTo 0
        .SaveToFile fileidx
        .Close
    End With
    Set WinHttpReq = Nothing
    Set oStream = Nothing

End Sub

OK ¤F.... ÁÂÁ«ü¾É

TOP

        ÀR«ä¦Û¦b : µoµÊ®ð¬Oµu¼ÈªºµoºÆ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD