再通过adodb.steam对象将二进制数据保存为图片文件。
Sub DownloadPic(url,strPath)
Set Winhttp = CreateObject("WinHttp.WinHttpRequest.5.1")
Winhttp.Open "GET", url
Winhttp.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
Winhttp.Send
Set sGet = CreateObject("ADODB.Stream")
sGet.Mode = 3
sGet.Type = 1
sGet.Open()
sGet.Write(Winhttp.ResponseBody)
sGet.SaveToFile strPath
End Sub
在此将代码分享给大家。