FTP to UNIX Site using Passive Mode in VBA through Excel RRS feed

  • Question

  • I need to connect to a UNIX Server and FTP (upload) files to it from Excel VBA.

    Apparently, the UNIX server requires PASSIVE mode, and I cannot get Visual Basic to get into Passive mode.

    Can anyone help?


    Tuesday, March 25, 2014 3:24 PM

All replies

  • The best FTP method I have found is using wininet.dll using win32 commands from VBA.  It supports passive mode using lFlags in InternetConnect.  You can bing/google it for examples like:




    This is what IE uses.  I used it to collect usage stats from Excel VBA addins.  It handled the heavy usage perfectly.

    Example Command

    Public Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" _
                                            (ByVal hInternetSession As Long, ByVal sServerName As String, _
                                             ByVal nServerPort As Integer, ByVal sUsername As String, _
                                             ByVal sPassword As String, ByVal lService As Long, _
                                             ByVal lFlags As Long, ByVal lContext As Long) As Long

    Sub OpenConnection(lngINET As Long, site As String, loginID As String, passWD As String, lngINETConn As Long)

      lngINETConn = InternetConnect(lngINET, site, 0, _
                                    loginID, passWD, 1, 0, 0)

    End Sub

    • Edited by mogulman52 Monday, March 31, 2014 10:40 PM
    Monday, March 31, 2014 10:35 PM