ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Executing an FTP call (https://www.excelbanter.com/excel-programming/398379-executing-ftp-call.html)

Mac Lingo[_2_]

Executing an FTP call
 
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



Leith Ross[_2_]

Executing an FTP call
 
On Sep 29, 8:13 am, "Mac Lingo" wrote:
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



All times are GMT +1. The time now is 06:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com