+ Reply to Thread
Results 1 to 2 of 2

Download ZIP file from FTP using macro?

  1. #1
    Registered User
    Join Date
    11-22-2004
    Posts
    7

    Download ZIP file from FTP using macro?

    Hi there

    I am able to open Excel file from ftp server using the command
    Workbooks.Open "ftp://ftp.my.com\1.xls"
    But is there some possibility, when I want to download and save on my PC (not open) ZIP file (not xls)?
    for example "ftp://ftp.my.com\pack.zip"

    I tried several ways, but unfortunately without any success. Workbooks.Open can only open the file, not save it

    If you have any suggestions, please inform me.
    Thanks a lot

    Cheers
    Pavel

  2. #2
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello Pavel

    you may try


    'source http://www.webace.com.au/~balson/InsaneExcel/Web.htm
    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

    Private Const ERROR_SUCCESS As Long = 0

    Sub LancementProcedure()
    DownloadFile "ftp://ftp.my.com/pack.zip", "C:\pack.zip"
    End Sub

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



    Regards ,
    michel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1