Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default File transfer using Shell

Mike,

In the batch file on the ftp command put the full path to the command file or
try changing drive and directory to the batch file in the batch file. where
the command file is.
--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"Mike" wrote:

Hi,

I'm not sure if this is an Excel question or an FTP one but in either case
any help would be appreciated.

I import files from a server onto my PC using these commands within a .bat
file called "import wams files.bat:-

cls
echo on
ftp -s:locquery.cmd incfam

incfam is the server and the .cmd file contains the actual files to get:-

cd /users/synergy/kemira/live/data
get LOFILE11 o:\products\wams\lofile11
get LOFILE12 o:\products\wams\lofile12
get LOFILE18 o:\products\wams\lofile18
get LOFILE19 o:\products\wams\lofile19
get LOFILE20 o:\products\wams\lofile20
get LOFILE22 o:\products\wams\lofile22
bye

It all works perfectly if a simply double click the .bat file but if I call
it from within Excel using:-

Sub getfiles()
Dim returnedvalue
returnedvalue = Shell("o:\products\wams\import wams files.bat", 1)
End Sub

The .bat file runs but the files aren't copied. Once again any thoughts
would be appreciated.

Mike

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default File transfer using Shell

Martin,

Thanks for that. Entering the full path name to the .cmd file and removing
the spaces from the file name and directory did the trick. Strange that the
problem only arose when called from within Excel but I think I'm happy not to
understand as long as it works.

Mike

"Martin Fishlock" wrote:

Mike,

In the batch file on the ftp command put the full path to the command file or
try changing drive and directory to the batch file in the batch file. where
the command file is.
--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"Mike" wrote:

Hi,

I'm not sure if this is an Excel question or an FTP one but in either case
any help would be appreciated.

I import files from a server onto my PC using these commands within a .bat
file called "import wams files.bat:-

cls
echo on
ftp -s:locquery.cmd incfam

incfam is the server and the .cmd file contains the actual files to get:-

cd /users/synergy/kemira/live/data
get LOFILE11 o:\products\wams\lofile11
get LOFILE12 o:\products\wams\lofile12
get LOFILE18 o:\products\wams\lofile18
get LOFILE19 o:\products\wams\lofile19
get LOFILE20 o:\products\wams\lofile20
get LOFILE22 o:\products\wams\lofile22
bye

It all works perfectly if a simply double click the .bat file but if I call
it from within Excel using:-

Sub getfiles()
Dim returnedvalue
returnedvalue = Shell("o:\products\wams\import wams files.bat", 1)
End Sub

The .bat file runs but the files aren't copied. Once again any thoughts
would be appreciated.

Mike

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
Using Shell To Get File Info MDW Excel Programming 2 July 7th 06 12:25 PM
Shell to different app then open file within Justin[_12_] Excel Programming 0 November 30th 04 11:26 PM
Shell command and exe file conundrum Greg Wilson[_4_] Excel Programming 2 September 4th 04 09:24 PM
Batch file in Shell Function Eric[_14_] Excel Programming 2 November 14th 03 11:08 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 03:33 PM.

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"