File Download - Excel-Firefox
I have the link to download an xls file. Every day I need to download this file (I can only access by firefox), save in a folder to feed my spreadsheet.(the spreadsheet is "linked" to that file. I need a macro that does: download this file(the link is already ready) automatically to a folder.
1
Author: Juniorjk123, 2017-05-07
1 answers
Try using the following adapted function with your data:
Sub downloadFile()
Dim myURL As String
myURL = "http://portal.convenios.gov.br/images/docs/CGSIS/csv/siconv.zip" ' Coloque sua URL aqui!!!
Dim WinHttpReq As Object
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
WinHttpReq.Open "GET", myURL, False
WinHttpReq.Send
myURL = WinHttpReq.ResponseBody
If WinHttpReq.Status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write WinHttpReq.ResponseBody
oStream.SaveToFile ("C:\Users\user\Downloads\file.zip")
oStream.Close
End If
End Sub
Code adapted from:
0
Author: Evis, 2017-05-07 23:14:42