Executing an FTP call

M

Mac Lingo

When I execute "Commands.Bat" (see below for content) in the CMD window,
the file "Commands.Out" is created in
"E:\Data - Mac\Mac's Documents\Application Data\".

But when I execute it from the Shell Command in Excel with
TS = Shell("Cmd /c Commands", vbNormalFocus)
the file "Commands.Out" is not created.
If I type "Cmd /c Commands" in the CMD window, it works.

Any ideas why this doesn't work in Excel?
Or is this just an error in my version of XP?
And if it is an error, how do I get around it?

tnx,
Mac

=============================================================================

Content of "Commands.Bat"
cd E:\Data - Mac\Mac's Documents\Application Data\
ftp -s:Commands.txt > Commands.Out


Content of "E:\Data - Mac\Mac's Documents\Application Data\Commands.txt:"
open FTP.Address
ftp_UserName
ftp_Password
Dir
bye
 
L

Leith Ross

When I execute "Commands.Bat" (see below for content) in the CMD window,
the file "Commands.Out" is created in
"E:\Data - Mac\Mac's Documents\Application Data\".

But when I execute it from the Shell Command in Excel with
TS = Shell("Cmd /c Commands", vbNormalFocus)
the file "Commands.Out" is not created.
If I type "Cmd /c Commands" in the CMD window, it works.

Any ideas why this doesn't work in Excel?
Or is this just an error in my version of XP?
And if it is an error, how do I get around it?

tnx,
Mac

=============================================================================

Content of "Commands.Bat"
cd E:\Data - Mac\Mac's Documents\Application Data\
ftp -s:Commands.txt > Commands.Out

Content of "E:\Data - Mac\Mac's Documents\Application Data\Commands.txt:"
open FTP.Address
ftp_UserName
ftp_Password
Dir
bye

Hello Mac,

When executing from VBA you need to change the current directory to E:
before executing the Shell statement...

ChDir "E:"
TS = Shell("Cmd /c Commands", vbNormalFocus)

Sincerely,
Leith Ross
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top