Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" ( _
ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Sub AAA()
Dim SourceName As String
Dim Destination As String
Dim R As Long
SourceName = "http://www.cpearson.com/zips/modDownloadFile.zip"
Destination = "D:\Test\modDownloadFile.zip"
R = URLDownloadToFile(0&, SourceName, Destination, 0&, 0&)
If R = 0 Then
Debug.Print "success"
Else
Debug.Print "error: " & CStr(Err.LastDllError)
End If
End Sub
答案 0 :(得分:0)
请尝试URLDownloadToFile(0, SourceName, Destination, 0, 0)
而不是URLDownloadToFile(0&, SourceName, Destination, 0&, 0&)
。