一个实例,和 Adodb.Stream 对象一起下载文件
- Dim objMsxml2Xmlhttp, objAdodbStream, strUrl, BinTemp
-
- Set objMsxml2Xmlhttp = CreateObject("Msxml2.Xmlhttp")
- Set objAdodbStream = CreateObject("Adodb.Stream")
-
- strUrl = "http://www.baidu.com/img/baidu_sylogo1.gif"
-
- With objMsxml2Xmlhttp '下载数据
- .Open "get", strUrl, False
- .Send
- BinTemp = .ResponseBody
- End With
-
- With objAdodbStream '保存为文件
- .Type = 1
- .Mode = 3
- .Open
- .Write BinTemp
- .SaveToFile "D:\baidu_sylogo1.gif"
- .Close
- End With
复制代码
|