’ Set your settings
strFileURL = “http://www.domain.com/file.zip”
strHDLocation = “D:\file.zip”’ Fetch the file
Set objXMLHTTP = CreateObject(“MSXML2.XMLHTTP”)objXMLHTTP.open “GET”, strFileURL, false
objXMLHTTP.send()If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject(“ADODB.Stream”)
objADOStream.Open
objADOStream.Type = 1 ‘adTypeBinaryobjADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 ’Set the stream position to the startSet objFSO = Createobject(“Scripting.FileSystemObject”)
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = NothingobjADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End ifSet objXMLHTTP = Nothing
Excell のVBAから同様に呼べるかな?
Posted via web from 原宿工業大学 | Comment »