Solved

Using VBA variables in MS DOS

Posted on 2009-05-10
3
656 Views
Last Modified: 2012-05-06
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
0
Comment
Question by:mk09
3 Comments
 
LVL 95

Accepted Solution

by:
Lee W, MVP earned 225 total points
Comment Utility
There's no easy way to do that.

I would suggest you use VBA to construct a batch file - then you can output the contents of fields - and then shell out to run the batch file.
0
 
LVL 10

Expert Comment

by:3_S
Comment Utility
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
0
 

Author Comment

by:mk09
Comment Utility
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.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now