(Solved) – Download multiple Files from Server

  • by
(solved)-–-download-multiple-files-from-server

i want to Download various files from a Server.

Every Link to the file is the same, except for the Number of the Document.
How do i have to edit the following Code, so that it e.g. loops through every value in Column B , adds the value of the cell to the specific part of the code and then downloads it??
The modifiable part is the Exxx Number.

Also, how do i make it to save the File with the corresponding E-Number?

Sub Downloaden_Reviews()

Dim dlURL As String


dlURL = "https:/downloadMultipleFiles?objectId=4706.39075.50944.58406&object=**E2638466**.xlsm"

Dim HttpReq As Object
Set HttpReq = CreateObject("Microsoft.XMLHTTP")

HttpReq.Open "GET", dlURL, False
HttpReq.send

dlURL = HttpReq.responseBody
If HttpReq.Status = 200 Then
    Set oStrm = CreateObject("ADODB.Stream")
    oStrm.Open
    oStrm.Type = 1
    oStrm.Write HttpReq.responseBody
    oStrm.SaveToFile "C:Users\DesktopE223.xlsm", 2 ' 1 = no overwrite, 2 = overwrite"
    oStrm.Close
End If
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *