Link to home
Start Free TrialLog in
Avatar of mk09
mk09

asked on

Using VBA variables in MS DOS

Hello,  I would like to take variables from a VBA form and insert them into a series of DOS commands.  For example,  the program would open a MS DOS window using

Call Shell("cmd.exe" & dosCmd, vbNormalFocus)

then I would like  text field1 from the form inserted into the MS DOS command line and a return command. This would be followed by  text field2 from the form inserted and a return command supplied.

This will go on until all the user supplied information from the form have been entered into MS DOS.  I am not sure how I can carry over these variables into MS DOS and how to execute the line.

thanks
ASKER CERTIFIED SOLUTION
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 3_S
3_S

I would also go for the batch file. you can redirect the output to a file with > to capture the return commands
example
cmd.exe program.bat > output.txt
Avatar of mk09

ASKER

Thanks for the input everyone.  I had a feeling I would be using a batch file for this (which implemented today).

Just wanted to see if anyone had success with carrying over the variables directly.