2013-05-27 1 views
0

여기에서 몇 가지 코드로 나를 도울 수 있기를 바랍니다. ftp 명령 파일을 만든 다음 배치 파일을 실행하는 모듈을 만들었습니다. Excel vba ftp가 성공했지만 서버에 문서가 없습니까?

나는 다른 StackOverflow의 게시물에서이 프로세스를 가지고 : FTP a text file to a server using VBA in Excel

시간 TEST.TXT 중 일부는 대부분의 시간을 그렇지, 서버에 표시됩니다. 그러나 ftp 프롬프트는 항상 성공적인 전송을보고합니다.

Screenshot of ftp.exe successful transferred.

Private Sub SendFileToServer() 
Dim sCmdFile As String 
Dim sBatFile As String 
Dim vPath As String 
Dim iFileNum As Integer 

vPath = ThisWorkbook.Path 
sCmdFile = vPath & "\" & "ftp" & "\" & "ftpCommand.txt" 
iFileNum = FreeFile 

    Open sCmdFile For Output As iFileNum 
    Print #iFileNum, "open 555.555.555.55" 
    Print #iFileNum, "user username" 
    Print #iFileNum, "password" 
    Print #iFileNum, "hash" 
    Print #iFileNum, "ascii" 
    Print #iFileNum, "lcd " & vPath 
    Print #iFileNum, "cd dsi_Timesheets" 
    Print #iFileNum, "put " & vPath & "\" & "test.txt" 
    Print #1, "close" 
    Print #1, "quit" 
    Close #iFileNum 

    Shell "ftp -n -i -g -s:" & vPath & "\ftp" & "\ftpCommand.txt " & vFTPServ, vbNormalNoFocus 
    SetAttr vPath & "\ftp" & "\ftpCommand.txt", vbNormal 
    Kill vPath & "\ftp" & "\ftpCommand.txt" 
End Sub 

감사

답변

0

문제를 알아 냈 : 나는에서는 Filezilla를 사용하여 FTP 서버의 파일을 볼 수 있어요. 내가 캐시 된 버전을보고 있었기 때문에 test.txt가 FTP 서버에 표시되지 않았습니다. 코드가 실행될 때마다 Filezilla의 ftp 디렉토리를 새로 고침으로써 text.txt가 있습니다.