VBA 下载文件

来源:互联网 发布:网络延长器怎么用图解 编辑:程序博客网 时间:2024/06/06 16:28
Function GetWebCode(ByVal strUrl As String) As StringDim HSet H = CreateObject("microsoft.XMLHTTP")H.Open "get", strUrl, FalseH.sendGetWebCode = H.responseTextSet H = NothingEnd FunctionSub Button1_Click()Dim H, SSet H = CreateObject("Microsoft.XMLHTTP")H.Open "GET", "http://www.yt-e.com/a.exe", False   '网络中的文件URLH.sendSet S = CreateObject("ADODB.Stream")S.Type = 1S.OpenS.write H.ResponsebodyS.savetofile "c:\a.exe", 2  '本地保存文件名S.CloseEnd Sub
原创粉丝点击