passing parameters to dos from vba..

G

groundstrike

hi, i am trying to open msdos from vba using shell command, and then to
pass a parameter or a command so that i could change the current
directory and then to run a program..

or is there a way that i could just paste a text in command prompt so
that wtever entered runs when the return key is pressed????
 
B

Bernie Deitrick

You don't need to change the directory - you could just use it as part of the shell command string:

Shell "C:\Path\FileName.exe"

Or with parameters:
Shell "C:\Path\FileName.exe /s"

HTH,
Bernie
MS Excel MVP
 
R

Rita

On top of opening the command prompt window...
Is it possible to run commands and copy the whole output...

for example,
think there's some script written by others (which i only know how to use)...
command to key => c:\display thisProduct

it will then display a table of information in Dos Mode
subsequently, i'll need to copy the whole table into excel spreadsheet...

This sounds kinda complicated... but that's the best way i can elaborate...
please advice.
Thanks in advance,
Rita
 
B

Bernie Deitrick

Rita,

You could pipe the output to a file, if your DOS program allows it, then open that file from Excel.
But I don't know of any way to capture the values in a DOS window and import them directly into
Excel.

HTH,
Bernie
MS Excel MVP
 
R

Rita

Thankx!! We'll give your idea a try.



Bernie Deitrick said:
Rita,

You could pipe the output to a file, if your DOS program allows it, then open that file from Excel.
But I don't know of any way to capture the values in a DOS window and import them directly into
Excel.

HTH,
Bernie
MS Excel MVP
 

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