Thread: File copy
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
SkylineGTR SkylineGTR is offline
external usenet poster
 
Posts: 20
Default File copy

Hi Don,

Found out how to do it and wanted to share with the group ..

Put the following in a module:

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

then create a wrapper:

Public Function DownloadFile(ByVal sURL As String, ByVal sLocalFile As
String) As Boolean
Dim lngRetVal As Long
DownloadFile = URLDownloadToFile(0&, sURL, sLocalFile, 0&, _
0&) = 0
End Function

then you can do:

DownloadFile("http://www.a.b.c/afile.zip","c:\afile.zip")