以下為程式碼
---------------------------------------------------------------------------------------------
Sub 下載檔案()
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
---------------------------------------------------------------------------------------------作者: GBKEE 時間: 2018-2-11 08:34