throws an error
cannot use parenthesis when calling a sub
i'm calling a function, what can I do to fix this?
Code:
file1 = "http://www.devguru.com/technologies/wsh/17413.asp"
downloadfile(file1, "c:\file.html")
function downloadfile(strFileURL, strHDLocation)
'http://blog.netnerds.net/2007/01/vbscript-download-and-save-a-binary-file/
' 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 'adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 'Set the stream position to the start
Set objFSO = Createobject("Scripting.FileSystemObject")
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
end function