Hello MartyH,

I was able to do this by installing NcFTP on my computer.  It is
available here: http://www.ncftp.com/download/.  You want to install
the client (not server.)

Once you install that program, modify the following code to accomplish
saving to an FTP file:

Sub SaveTXT2FTP()
'
' SaveTXT2FTP Macro
'

' ********** Declarations **************
    Dim strFileName As String
    Dim strPath As String

    Dim strFTPServer As String
    Dim strFTPPath As String
    Dim strFTPUsername As String
    Dim strFTPPassword As String

' ************ Settings *************
    strFTPServer = "ftp.server.com"
    strFTPUsername = "username"
    strFTPPassword = "my.password"
    strFTPPath = "path"

    strPath = "C:\Users\Publice\Documents\"
    strFileName = "Filename.txt"

' ************* Export to TXT File *****************
    ActiveWorkbook.SaveAs Filename:=strPath & strFileName, _
        FileFormat:=xlTextMSDOS

' ************* Upload to FTP Server **************
    Shell ("C:\Program Files\NcFTP\ncftpput.exe -u " & strFTPUsername
& _
        " -p " & strFTPPassword & " " & strFTPServer & " " & _
        strFTPPath & " " & strPath & strFileName)

End Sub

I tested on my computer using Excel 2007 and it worked.  You can copy
and paste the sections into the appropriate place in your code.  The
section "Export to TXT File" does not have to be copied if you will be
using your own.  However, just make sure you specify the file in the
"Settings" section.

Please post back if this was helpful, or if you have any issues.

--==)) Justo ((==--

On Jul 20, 4:06 am, MartyH <martyn.ho...@gmail.com> wrote:
> Hi all,
>
> I currently have a macro that takes data from a spreadsheet and
> reformats it to a pipe delimited .txt file then saves to a location on
> my C: drive.
> I then manually place the file on an ftp server - is there any way
> that I can save the file direct to the ftp server or move it from my
> C:drive to the ftp server?
>
> I have read a few articles on API that seem to suggest a solution but
> my VBA understanding isn't quite to the level where I can fully
> undersatnd the code in published examples and thus tweak it to my
> exact requirements.
> Any help would be freatly appreciated.
>
> Many thanks,
>
> MartyH

--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 5,000 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---

Reply via email to