Public 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
Public Function bDownLoadFile(strURL As String, strFileName As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, strURL, strFileName, 0, 0)
If lngRetVal = 0 Then
bDownLoadFile = True
End If
Exit Function
errHandler:
Debug.Print "Error Source:", Err.Source
Debug.Print "Error Description:", Err.Description
Debug.Print "Error Number:", Err.Number
MsgBox "An error has occured attempting to start download to " & strURL
bDownLoadFile = False
End Function
' Вызов:
bDownLoadFile("http://sitename/files/text.txt", sПутьКЗагружаемымФайлам & "\text.txt")