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

[µo°Ý] oStream.SaveToFile ()ÀɦW°ÝÃD

[µo°Ý] oStream.SaveToFile ()ÀɦW°ÝÃD



½Ð°ÝoStream.SaveToFile ()¬A©·¸Ì­±­n¥´¤°»ò¡A¤~¯àÅý¦sÀɪºÀɦWµ¥©ó¤U¸üÀɮתº­ìÀɦW¤@¼Ò¤@¼Ë
¨Ò¦p:¤U¸üªºÀɮצWºÙ¡u123.xls¡v¡A¦sÀɪºÀɦW´N¦P¤U¸üÀɦW¡u123.xls¡v
¤U¸üªºÀɮצWºÙ¡uABC.pptx¡v¡A¦sÀɪºÀɦW´N¦P¤U¸üÀɦW¡uABC.pptx¡v

¥H¤U¬°µ{¦¡½X
---------------------------------------------------------------------------------------------
Sub ¤U¸üÀÉ®×()
Dim myURL As String
myURL = "http://w3.hdut.edu.tw/ezcatfiles/a001/img/img/507/EDOC_20171120.pptx"

Dim WinHttpReq As Object
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
WinHttpReq.Open "GET", myURL, False
WinHttpReq.Send

myURL = WinHttpReq.ResponseBody
If WinHttpReq.Status = 200 Then
    Set oStream = CreateObject("ADODB.Stream")
    oStream.Open
    oStream.Type = 1
    oStream.Write WinHttpReq.ResponseBody
    oStream.SaveToFile (ActiveWorkbook.Path & "\" & ?)
    oStream.Close
End If
End Sub
---------------------------------------------------------------------------------------------
*¦v¤k¤@ªTµL»~*

¦^´_ 1# msmplay
  1. Dim myURL As String, xFile As String
  2.     myURL = "http://w3.hdut.edu.tw/ezcatfiles/a001/img/img/507/EDOC_20171120.pptx"
  3.     xFile = Mid(myURL, InStrRev(myURL, "/") + 1)
  4.      oStream.SaveToFile ActiveWorkbook.Path & "\" & xFile
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

Mid(myURL, InStrRev(myURL, "/") + 1, 99)
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 2# GBKEE


   G¤j¦A¦¸·PÁ§A¼ö¤ßÀ°¦££°
*¦v¤k¤@ªTµL»~*

TOP

¦^´_ 3# ML089


   M¤j«D±`·PÁ£¬
*¦v¤k¤@ªTµL»~*

TOP

        ÀR«ä¦Û¦b : «H¤ß¡B¼Ý¤O¡B«i®ð¤TªÌ¨ã³Æ¡A«h¤Ñ¤U¨S¦³°µ¤£¦¨ªº¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD