Hi there,
I am having some problems with a very basic FTP macro I am trying to create.
I firstly went to this forum:
http://www.ozgrid.com/forum/showthre...985#post303985
I then modified that code to:
[vba]Sub ftpUpload()
Dim fs As Variant
Dim FTPScript As Variant
Cells(21, 6).Select
localFile = ActiveCell.Value
Set fs = CreateObject("Scripting.FileSystemObject")
Set FTPScript = fs.CreateTextFile("C:\FTPXfer.txt", True)
With FTPScript
.Writeline ("OPEN 127.0.0.1")
.Writeline ("USER jeremy s56pj989")
.Writeline ("ASCII") 'Either BINARY or ASCII (just choose when on Linux!
.Writeline ("CD ../dest")
.Writeline ("LCD " & ThisWorkbook.Path & "\")
.Writeline ("PUT 14-09_04-03-2009_UPLOADproducts.csv 14-09_04-03-2009_UPLOADproductsUPLOADED.csv")
'.Writeline ("BYE")
'.Close
End With
Call Shell("C:\WINDOWS\System32\ftp.exe -ns:c:\FTPXfer.txt", vbMaximizedFocus) ' or MinimizeFocus
'NEED TO MAKE COMMAND TO REMOVE 'c:\FTPXfer.txt'
End Sub[/vba]
But it appears to be uploading a blank CSV file (even though there's data in the local directory one) is there anyway of getting it working so that the uploaded CSV to my server (at the moment its localhost or 127.0.0.1 same as localhost) but it appears to be uploading a blank CSV file, why is this and what is the solution, does anyone know?
BTW activecell.value is the file name of the last CSV upload Im trying to make it so we can do automated backups of files by date and time of the file being processed from our suppliers site.
Thanks,
Jez.