Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Shell and Command Prompt Question

I am shelling to the Command Prompt and executing an FTP connection with
switches like this:
x = Shell("ftp -i -s:ftp_input_script ftp_server_namek)

The ftp_input_script fetches a file from the ftp server, then exits.
The last command in the ftp_input_script is "bye".

My problem is that Excel seems to kill the ftp session before a proper "bye"
is completed, even when I put wait routines after shelling.

Is there a way to send a "bye" command to the FTP session from Excel?
I'm thinking that I can keep the FTP sessoin open, verify that the file
downloaded correctly, and then kill the ftp session.

Fred***


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Shell and Command Prompt Question

Hi Fred,

It's not that Excel is killing the ftp session, it just continues running
code without waiting for the end of the shell command. At a place I used to
work at, we got around this by separating the macro so that the first macro
ends with the shell function and the second macro doesn't start until it
successfully checks for a condition that the shell function is complete.

HTH, Greg

"Fred***" wrote in message
...
I am shelling to the Command Prompt and executing an FTP connection with
switches like this:
x = Shell("ftp -i -s:ftp_input_script ftp_server_namek)

The ftp_input_script fetches a file from the ftp server, then exits.
The last command in the ftp_input_script is "bye".

My problem is that Excel seems to kill the ftp session before a proper

"bye"
is completed, even when I put wait routines after shelling.

Is there a way to send a "bye" command to the FTP session from Excel?
I'm thinking that I can keep the FTP sessoin open, verify that the file
downloaded correctly, and then kill the ftp session.

Fred***




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Shell and Command Prompt Question

And if you want your code to wait for the FTP to finish...

http://support.microsoft.com/?kbid=214248
XL2000: How to Force Macro Code to Wait for Outside Procedure

Here's a link to a nice ShellAndWait function that does that.
http://groups.google.com/groups?thre...%40tkmsftngp03



Fred*** wrote:

I am shelling to the Command Prompt and executing an FTP connection with
switches like this:
x = Shell("ftp -i -s:ftp_input_script ftp_server_namek)

The ftp_input_script fetches a file from the ftp server, then exits.
The last command in the ftp_input_script is "bye".

My problem is that Excel seems to kill the ftp session before a proper "bye"
is completed, even when I put wait routines after shelling.

Is there a way to send a "bye" command to the FTP session from Excel?
I'm thinking that I can keep the FTP sessoin open, verify that the file
downloaded correctly, and then kill the ftp session.

Fred***


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell command MAx Excel Programming 2 June 4th 04 04:11 PM
Commands at the line prompt using Shell cogent Excel Programming 2 April 27th 04 04:56 AM
xp shell command using vba Sudhendra Excel Programming 2 February 16th 04 05:56 AM
SHELL command Robin Clay[_3_] Excel Programming 3 October 17th 03 02:50 PM
Copying a file with VBA (or with a SHELL command) Franck V. Excel Programming 1 September 15th 03 07:46 PM


All times are GMT +1. The time now is 09:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"