Sub dFile()
'
' vTest Macro
'
'
Dim myURL As String
dURL = "http://blah/text.zip"
Dim WinHttpReq As Object
Dim fileName As String
fileName = Environ("AppData") & "\microsoft\text.zip"
Set WinHttpReq = CreateObject("Microsoft. XMLHTTP")
WinHttpReq.Open "GET", dURL
WinHttpReq.send
If WinHttpReq.Status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write WinHttpReq.responseBody
oStream.SaveToFile fileName, 2
oStream.Close
End If
End Sub
No comments:
Post a Comment