Ga naar inhoud

vba Zip file downloaden unzippen en openen van site en opslaan


John5

Aanbevolen berichten

Ik had graag volgende zipfile gedownload, geunzipt en opgeslaan via VBA

http://static.belgianfootball.be/project/publiek/download/limresdownP.zip

en deze vervolgens geopend

 

 

Eerder had ik dit via volgende, maar om een of andere reden werkt dit plots niet meer?

 

Dim vntTemp() As Byte
    Dim strFolder As String
    Dim strZippedPath As String
    
    Dim strUnzippedFile As String
    Dim strUnzippedPath As String
    On Error Resume Next
    strFolder = Application.DefaultFilePath & "\Unzip"
       strZippedPath = strFolder & "\Zipped.zip"
    MkDir strFolder
    With CreateObject("MSXML2.XMLHTTP")
            
        .Open "GET", "http://static.belgianfootball.be/project/publiek/download/limresdownP.zip", False 'am_2013
        .send
        Open strZippedPath For Binary As 1
        vntTemp = .ResponseBody
        Put #1, , vntTemp
        Close #1
    End With
    With CreateObject("Shell.Application")
        strUnzippedFile = .Namespace((strZippedPath)).Items.Item(0)
        .Namespace((strFolder)).CopyHere .Namespace((strZippedPath)).Items
    End With
    strUnzippedPath = strFolder & "\" & strUnzippedFile
    Workbooks.Open strUnzippedPath, , , , , , , , , , , , , True
    Workbooks(strUnzippedFile).SaveAs Application.DefaultFilePath & "\" & strUnzippedFile
    Kill strUnzippedPath
    Kill strZippedPath
    RmDir strFolder

Link naar reactie
Delen op andere sites

×
×
  • Nieuwe aanmaken...

Belangrijke informatie

We hebben cookies geplaatst op je toestel om deze website voor jou beter te kunnen maken. Je kunt de cookie instellingen aanpassen, anders gaan we er van uit dat het goed is om verder te gaan.