Thursday, 15 May 2014

excel vba - Connect to FTP Server via VBA, "Put" function for *.XLSB local file -



excel vba - Connect to FTP Server via VBA, "Put" function for *.XLSB local file -

ive tried several different things ive found on here , nil has worked me 1 below:

option explicit const ftp_address = "ftp.yourdestination.com" const ftp_userid = "anon" const ftp_password = "anon" sub macro1() if not sendftpfile_f() msgbox "could not ftp file" else msgbox "sent" end if end sub function sendftpfile_f() boolean dim rc integer dim ifreefile integer dim sftpuserid string dim sftppassword string dim sworkingdirectory string dim sfiletosend string const ftp_batch_file_name = "myftpfile.ftp" const increased_buffer_size = 20480 sendftpfile_f = false sworkingdirectory = "c:\yourworkingdirectory\" sfiletosend = "nameoffile.txt" on error goto ftpnecafile_eh 'kill ftp process file if exists if dir(sworkingdirectory & ftp_batch_file_name) <> "" kill sworkingdirectory & ftp_batch_file_name end if 'create ftp process file ifreefile = freefile open sworkingdirectory & ftp_batch_file_name output #ifreefile print #ifreefile, "open " & ftp_address print #ifreefile, ftp_userid print #ifreefile, ftp_password print #ifreefile, "mput " & sworkingdirectory & sfiletosend print #ifreefile, "quit" close #ifreefile 'shell command ftp file server shell "ftp -i -w:20480 -s:" & sworkingdirectory & ftp_batch_file_name sendftpfile_f = true goto ftpnecafile_ex ftpnecafile_eh: msgbox "err", err.name ftpnecafile_ex: exit function end function

can please assist. need connect "ftp server" , upload same excel file (closeout.xlsb) vba code wrote in it. nil has worked me.

file location = c:\goodman input files file name = closeout.xlsb

connecting = "ftp.myserver.com"

need assistance,

lock

excel-vba

No comments:

Post a Comment