VB Macro to ftp file

Go To StackoverFlow.com

-1

I have a CSV file.Once i click button on csv file.I have to copy that file using ftp into unix server using VB macro.

No clues on this.Please provide any kind of sample.

Regards,

chaitu

2012-04-04 18:08
by Raj
What happened when you Googled "VB FTP"? I'm guessing you saw the same hits I did, so did you try any of them out - Tim Williams 2012-04-04 19:48


2

I wrote some code to FTP gif files. You can see all the code at

http://www.dailydoseofexcel.com/archives/2006/01/29/ftp-via-vba/

There's a lot more there than you need, but the relevant parts are:

'Create text file with ftp commands
Open sFname & ".txt" For Output As lFnumFtp
Print #lFnumFtp, "open " & sSITE 'open the site
Print #lFnumFtp, sUSER
Print #lFnumFtp, sPASS
Print #lFnumFtp, "binary" 'set file transfer mode
Print #lFnumFtp, "cd " & sDIR
For i = LBound(vFname) To UBound(vFname)
    Print #lFnumFtp, "send " & Dir(vFname(i)) 'send files
Next i
Print #lFnumFtp, "bye" 'close ftp session

Close lFnumFtp  'close text file

lFnumBatch = FreeFile

'open a batch file
Open sFname & ".bat" For Output As lFnumBatch
Print #lFnumBatch, "ftp -s:" & sFname & ".txt"
Print #lFnumBatch, "Echo ""Complete""> " & sFname & ".out"
Close lFnumBatch

'run the batch file
Shell sFname & ".bat"
2012-04-04 19:53
by Dick Kusleika
i dont want to create any text files.just i want to copy csv files from windows to unix server using ftp with macro - Raj 2012-04-04 22:44
Ads