Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Running a batch file from VB

I am trying to execute a batch file from visual basic.
While the VB help suggests ways to execute DLL or enable
OLE objects, these are well beyond my skill area. I can't
find anything specific in help to allow me to run a batch
file automatically.

When running the program manually, I open a command prompt
window and run the batch file from there. I would like to
automate this from Excel.

Thx in advance, GC
p.s. How do you search the newsgroup aside from scrolling
through the postings?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Running a batch file from VB

Hi

Use something like this to select the drive and dir you want.

ChDrive "D" ' be sure you are logged on to the drive you want, in this
case drive "D"
ChDir "\my music" ' change to the dir you want to be in, starting first at
the root dir (the \)


MsgBox CurDir ' show me where I am


To close the dos window after the batch file ends, I assume you are using
win 98 since win xp seems to do this as the default.

After running the batch file, with the dos window open, right click on the
dos window title bar. Select properties. On one of the tabs(I forget which
one and am not on a win 98 system) you will see a checkbox with the caption
" Close on Exit". Check the checkbox. Click apply. Click OK.

Now it should close automatically after it finishes running.


HTH

Ken M



"Graham Carter" wrote in message
...
I am trying to execute a batch file from visual basic.
While the VB help suggests ways to execute DLL or enable
OLE objects, these are well beyond my skill area. I can't
find anything specific in help to allow me to run a batch
file automatically.

When running the program manually, I open a command prompt
window and run the batch file from there. I would like to
automate this from Excel.

Thx in advance, GC
p.s. How do you search the newsgroup aside from scrolling
through the postings?



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


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
batch file camilia Excel Discussion (Misc queries) 0 February 1st 07 01:59 PM
Would Like to Automate Batch File Creation and Text FIle Import socrtwo Excel Discussion (Misc queries) 2 August 18th 06 03:54 PM
Hide Excel session when running at the batch mode xiaoxshi Excel Discussion (Misc queries) 1 July 23rd 06 03:54 PM
Run a Batch file with variables Stuartf Excel Discussion (Misc queries) 1 May 24th 06 04:55 PM
Running a batch file from Excel VBA verizon Excel Programming 1 July 20th 03 09:27 AM


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

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"