Computer Hope
Software => Computer programming => Topic started by: ajetrumpet on November 02, 2009, 12:03:53 PM
-
hello all,
There is a problem I can't get my head around. I have this code for example: Dim vPath As String
Dim vFTPServ As String
Dim fNum As Long
vPath = "C:"
vFTPServ = "www.domain.com"
fNum = FreeFile()
Open vPath & "\FtpComm.txt" For Output As #fNum
Print #1, "USER myUN" ' your login
Print #1, "pass" ' your password
Print #1, "dir " & Me.namefield & " c:\test.txt"
Print #1, "close"
Print #1, "quit"
Close
Shell "ftp -n -i -g -s:" & vPath & "\FtpComm.txt " & vFTPServ, vbHide
i am doing this everytime I want to view the contents of the TEST text file. my question is, is there a way that I can leave the FTP session open, and keep printing lines in the FTPCOMM file and keep executing DOS commands one at a time this way instead of opening and closing the connection each time?
I am getting a huge delay in updates when I run this procedure seperately evertime I want to update my interface with the DOS output, so if I can leave the session open I think I can completely eliminate the time I have to wait! I am using VBA with Office 2003 and windows vista. thanks all!
-
do you absolutely have to do this with VBA? you are using the wrong choice of tools to do FTP.
-
i do need to do it in VBA, yes. I searched for the INET active X, but apparently you have to pay to get it downloaded. is that true?
-
i do need to do it in VBA, yes. I searched for the INET active X, but apparently you have to pay to get it downloaded. is that true?
I am not sure because I don't have to pay to do programming. If you are being forced to pay to program, then you are being ripped off. A lot of stuff to do programming are free. Perl/Python etc comes with excellent FTP libraries that makes your file transfer job easier. If you can find a library that you can use with VBA that is free, go ahead and use it.