Option Explicit
Const cFIL = "Filen.zip"
Const cOUT = "C:\temp\"
Const cURL = "
http://www.eee.dk/fld/" Dim intOUT
Dim strOUT
strOUT = cOUT & cFIL
Dim strURL
strURL = cURL & cFIL
Call fetch(strURL,strOUT)
msgbox "Filen er downloadet til: " & strOUT
Function fetch(url,out)
'On Error Resume Next
Err.Clear
Dim b
With CreateObject("Microsoft.XMLHTTP")
.Open "GET",url,False
.Send
b = .ResponseBody
If Err.Number <> 0 Or .Status <> 200 Then
fetch = False
msgbox "fejl"
Exit Function
End If
End With
With CreateObject("ADODB.Stream")
.Type = 1
.Open
.Write b
.SaveToFile out,2
End With
fetch = Err.Number = 0
End Function