VBA POST §ìÃÒ¥æ©Ò ¨C¤é¦¬½L¦æ±¡(¥þ³¡(¤£§tÅvÃÒ¡B¤ûºµÃÒ)
- ©«¤l
- 1
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 2
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2015-1-27
- ³Ì«áµn¿ý
- 2015-2-2
|
VBA POST §ìÃÒ¥æ©Ò ¨C¤é¦¬½L¦æ±¡(¥þ³¡(¤£§tÅvÃÒ¡B¤ûºµÃÒ)
¸Õ¸Õ¬Ý~¦³§ó¦nªº¤èªk½Ð¤j®a¤@°_°Q½×~
n¦³¤u§@ªí WW..¨Ã¦b A1 ¤W¦³¤é´Á¦p 2015/01/05
¦A«Ø¤@Ó¤u§@ªí dd...
Sub XL()
Dim wt As Date
wt = Sheets("ww").Range("A1").Value
xt = Format(wt, "E/MM/DD")
gt = Format(wt, "E-MM-DD")
Set XML = CreateObject("Microsoft.XMLHTTP")
Set stream = CreateObject("ADODB.stream")
Dim path As String, thePOSTdata, URL
path = "C:\"
Set sh = Sheets("dd")
Sheets("dd").Activate
Worksheets("dd").UsedRange.Offset(0).Clear
URL = "http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/MI_INDEX.php"
thePOSTdata = "download=csv&qdate=" & xt & "&selectType=ALLBUT0999"
XML.Open "POST", URL, 0
XML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
XML.send thePOSTdata
With stream
.Open
.Type = 1
.write XML.responseBody
If Dir(path & "¦¬½L" & gt & ".csv") <> "" Then Kill (path & "¦¬½L" & gt & ".csv")
.SaveToFile (path & "¦¬½L" & gt & ".csv")
.Close
End With
With Workbooks.Open(path & "¦¬½L" & gt & ".csv")
.Sheets(1).UsedRange.Offset(117, 0).Copy sh.[a1]
.Close 0
End With
End Sub |
|
|
|
|
|
|
- ©«¤l
- 78
- ¥DÃD
- 30
- ºëµØ
- 0
- ¿n¤À
- 109
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- XP
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2014-5-15
- ³Ì«áµn¿ý
- 2018-9-16
|
§Ú¤]ÆZ·Qª¾¹Dªº
«ç»ò¤£¥Î¤@Óºô¶¦³³o¨Ç¸ê®Æ´N¦n¤F ¥Îºô¶§ì
¯u¬O ·Ð¦º¤F |
|
|
|
|
|
|