excel - Shell command not generating output file -
i have following line of code in macro:
shell("importfile.bat"), vbhide
here's have in importfile.bat:
ftp -n -i -g -s:import.ftp > c:\log.txt
for reason whenever run macro, log.txt file gets generated file empty. when manually try run batch file, see output of ftp command.
am doing wrong?
tried below.. able see out.txt ftp data, think ftp command not able import.ftp file path in excel macro.. try giving full path. can try below code.
sub ftp_button() batfile = freefile ftpbat = thisworkbook.path & "\test.bat" ftpout = thisworkbook.path & "\out.txt" ftpcmd = thisworkbook.path & "\import.ftp" 'existing ftp file - file contains 1 stmt "open 127.0.0.1" if dir(ftpbat) <> "" kill (ftpbat) if dir(ftpout) <> "" kill (ftpout) open ftpbat output #batfile print #batfile, "ftp -n -i -s:" & ftpcmd; " > " & ftpout close #batfile shell (ftpbat), vbhide
end sub
Comments
Post a Comment