VBA - choose save as from the frame notification bar of internet explorer

前端 未结 1 1551
时光说笑
时光说笑 2021-01-17 04:58

I am trying to download a file with save as through the frame notification bar of internet explorer. However after doing a lot of searches, I have only foun

1条回答
  •  逝去的感伤
    2021-01-17 05:22

    I tried simply to download a file by the link http://www.tvsubtitles.net/download-114117.html, which can be found on the webpage http://www.tvsubtitles.net/subtitle-114117.html, and it worked for me, here is the code:

    Sub Test_download_tvsubtitles_net()
    
        DownloadFile "http://www.tvsubtitles.net/download-114117.html", ThisWorkbook.Path & "\download-114117.zip"
    
    End Sub
    
    Sub DownloadFile(sUrl, sPath)
    
        Dim aBody
    
        With CreateObject("MSXML2.XMLHTTP")
            .Open "GET", sUrl, False
            .Send
            aBody = .responseBody
        End With
        With CreateObject("ADODB.Stream")
            .Type = 1 ' adTypeBinary
            .Open
            .Write aBody
            .SaveToFile sPath, 2 ' adSaveCreateOverWrite
            .Close
        End With
    
    End Sub
    

    0 讨论(0)
提交回复
热议问题