Results 1 to 8 of 8
  1. #1
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Copying files from FTP location via VBA

    I am seeking a method of copying files from and ftp location using VBA. I have a batch file that does what I need, but prefer a VBA solution. I have tried using VBA to call a batch file that calls a script, but the window opens and then closes, without having copied the files.

    Any help and ideas are greatly appreciated.

    Batch file
    Code:
    ECHO OFF
    
    REM ************************************************************************************************
    REM SCRIPT NAME    ::: scriptOIB.txt is called by this bat file--> OIB.bat
    REM MODULE         ::: This script is used to download the file from FTP Site to the  Source Folder.
    REM AUTHOR         ::: Ken Van Huss
    REM DESCRIPTION    ::: This script is used to download the source files from FTP Site for 
    REM                   ::: RM staff
    REM DATE WRITTEN   ::: 7-Sept-2011      
    REM VERSION        ::: 1.0     7-Sept-2011 --> Initial Version.                                                      
    REM *************************************************************************************************
    ftp -s:ScrptCpy.txt
    text file called from above is "ScrptCpy"
    Code:
    open 202.301.30.192
    myfiles\Ken001
    blahblahblah
    cd inbound\test
    prompt off
    ascii
    lcd c:\_Files
    mget *.*
    bye
    Last edited by jscher2000; 2011-09-07 at 19:49. Reason: Edited pw just in case

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    VBA can automate the ActiveX controls that form the heart of Internet Explorer, so there's a reasonable chance you can do it from VBA. However, documentation has become more sparse over time as developers have migrated to VB.Net, so it could be tricky to find code that works with current versions of Windows/IE.

    These older Lounge threads have links to some code samples and documentation for the Wininet library:

    Download Online Documents via HTTP
    FTP - wininet.dll, How to? (WinXP SP2, XL 2003 UK)

    In addition to the free FTP functionality of Windows, there are third party ActiveX/COM libraries for FTP and other network connectivity. I haven't used any of them myself.

  3. The Following User Says Thank You to jscher2000 For This Useful Post:

    kwvh (2011-09-08)

  4. #3
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Thanks for the information. I will research the third party libraries and see what works.
    Thanks!

  5. #4
    2 Star Lounger HiTechCoach's Avatar
    Join Date
    Sep 2011
    Location
    Oklahoma City, OK
    Posts
    162
    Thanks
    0
    Thanked 24 Times in 24 Posts
    I have this example: FTP Client functions

    These links should be helpful: Access Developer Tools: Apps, Add-ins, VBA Code
    Check out the link for Chilkat Software


    Boyd Trimmell aka HiTechCoach
    Microsoft MVP - Access Expert


    Boyd Trimmell aka HiTechCoach (Access Information here)
    Microsoft MVP - Access Expert
    "If technology doesn't work for people, then it doesn't work."

  6. The Following User Says Thank You to HiTechCoach For This Useful Post:

    kwvh (2011-09-09)

  7. #5
    Star Lounger
    Join Date
    Mar 2010
    Location
    Winston-Salem, NC USA
    Posts
    52
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Here's a VB basic module (see attached file) that I created some years ago for FTP Puts and Gets using API calls. It worked using some older version of IE components (I don't remember the version) under XP. You're welcome to try it out. If you can use a bas module in your project then just rename the file extension to .bas

    You'll want to focus on the Public subs and the incoming arguments.
    Attached Files Attached Files
    Last edited by Bender; 2011-09-08 at 18:33. Reason: spelling correction
    Do your part!!! Report SPAM to http://www.spamcop.net/

  8. The Following User Says Thank You to Bender For This Useful Post:

    kwvh (2011-09-09)

  9. #6
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Boyd,
    THANKS ! ! What an excellent tool! I will give it a shot. It looks really well done.

    Ken

  10. #7
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Bender,

    thanks. will try to get it to run in VB.NET, which I am brand new to.

    Ken

  11. #8
    2 Star Lounger HiTechCoach's Avatar
    Join Date
    Sep 2011
    Location
    Oklahoma City, OK
    Posts
    162
    Thanks
    0
    Thanked 24 Times in 24 Posts
    Quote Originally Posted by kwvh View Post
    Boyd,
    THANKS ! ! What an excellent tool! I will give it a shot. It looks really well done.

    Ken
    Ken,

    You're welcome.

    Hope it helps.
    Boyd Trimmell aka HiTechCoach (Access Information here)
    Microsoft MVP - Access Expert
    "If technology doesn't work for people, then it doesn't work."

Posting Permissions

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