- ©«¤l
- 41
- ¥DÃD
- 8
- ºëµØ
- 0
- ¿n¤À
- 64
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- OFFICE2010
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2015-3-11
- ³Ì«áµn¿ý
- 2020-10-7
|
[µo°Ý] ²{¦bn¦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 |
|