Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old May 17th 12, 10:57 AM
Junior Member
 
First recorded activity by ExcelBanter: Apr 2012
Posts: 10
Post Executing a .BAT file using excel macro

HI

I have a .bat file which downloads a Mainframe file into a text file through FTP into my local machine.I need to execute this .bat file through excel vba. I tried the below shell script commands.

sYourCommand = "C:\Documents and Settings\FTP\mtc\extract.bat"
x = Shell("cmd.exe /c " & sYourCommand, 1)

The command window opens but the file is not downloaded.

when i execute the .bat file manually i get the files downloaded. Please help me to excute this .bat file throough excel vba.


Below details may help

the .bat file command ---------- ftp -s:file1.txt 192.74.252.153
file1.txt ( in the same location as .bat file )contains the user credentials and mainframe and local file name details.
as below

k9999
tda1234
get 'PJJJ.NVS.PJJJDSLA.SLARRRD.JJJ(0)' sla.txt

Last edited by Vasanth : May 17th 12 at 11:00 AM

  #2   Report Post  
Old May 19th 12, 05:11 PM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: May 2010
Posts: 143
Default Executing a .BAT file using excel macro

On Thursday, May 17, 2012 5:57:24 AM UTC-4, Vasanth wrote:
HI

I have a .bat file which downloads a Mainframe file into a text file
through FTP into my local machine.I need to execute this .bat file
through excel vba. I tried the below shell script commands.

sYourCommand = "C:\Documents and Settings\FTP\mtc\extract.bat"
x = Shell("cmd.exe /c " & sYourCommand, 1)

The command window opens but the file is not downloaded.

when i execute the .bat file manually i get the files downloaded. Please
help me to excute this .bat file throough excel vba.


Below details may help

the .bat file command ---------- ftp -s:file1.txt 192.74.252.153
file1.txt ( in the same location as .bat file )contains the user
credentials and mainframe and local file name details.
as below

k9999
tda1234
get 'PJJJ.NVS.PJJJDSLA.SLARRRD.JJJ(0)' sla.txt




--
Vasanth


Consider putting a
pause
at the end of the bat file

That way you can see what is going on.


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
Executing a macro in another file NSNR Excel Discussion (Misc queries) 1 December 11th 07 01:35 PM
Executing a bat file from Excel Mr BT[_2_] Excel Worksheet Functions 9 April 16th 07 09:18 PM
File Already Open Error When Executing A Macro Chuckles123[_26_] Excel Programming 0 October 7th 04 06:20 PM
File Already Open Error When Executing A Macro Chuckles123[_25_] Excel Programming 0 October 7th 04 05:48 PM
Executing an older excel 4.0 macro pgerrish Excel Programming 0 April 22nd 04 05:41 PM


All times are GMT +1. The time now is 02:11 AM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017