Using a "SHELL" Command

M

Mac Lingo

I'm getting an error message that implies that I can't call a procedure on
my system:
"This error can also occur if an attempt is made to call a procedure that
isn't valid on the current platform."
I'm running VBA 2003.

And the procedure I'm trying to run is to invoke a batch file ith the line

TS = Shell(FileName & ".bat", vbMinimizedNoFocus)

Any idea why this isn't working???

Mac in Berkeley, CA
 
M

Mac Lingo

Re Tom Olg's note, the file directory is specified.

But I thought it might be useful to show the batch file:

ftp -s:E:\Data - Mac\Mac's Documents\My Stuff\Programs\Directory.txt
Echo "Complete" > E:\Data - Mac\Mac's Documents\My
Stuff\Programs\Directory.out

And Directory.txt:
open FTP....
username
password
cd ...\Mac's\
binary
send E:\Data - Mac\Mac's Documents\My Stuff\Programs\Directory.txt
Diretory.txt
bye
 
M

Mac Lingo

The last line has been fixed as follows.

to
send E:\Data - Mac\Mac's Documents\My Stuff\Programs\Directory.txt
Directory.txt

Doesn't fix it.
 
G

gimme_this_gimme_that

You ftp script is a joke.

Put the following in a file having a suffix .scr, for example,
example.scr.
Use forward slashes not backslashes
Use put not send
"lcd" means "local cd"
Use \ to escape blanks

user username password
bi
cd /Mac's
lcd E:/Data\ -\ Mac/Mac's\ Documents/My\ Stuff/Programs
put "Directory.txt"
quit

Get your ftp script running on the command line. After that change
your VBA to:

TS = Shell("ftp -s hostname example.scr", vbMinimizedNoFocus)
 
M

Mac Lingo

Can "SHELL" execute a Batch Command.

And once the command is executed, how do I get the results of running the
FTP command back to me?

Mac
 
J

JE McGimpsey

I assume a comma is missing:

The batch file DOES work if you double-click it, right?
 

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