Running into the unknown

I wish to run a Program that was typed in Text1 By the user.  I can't seam to find a way to turn Text1.text into Variable (A) and use it in the ShellExecute (A) command. Am I going about it the wrong way?
R_N_WARDAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cable4096Commented:
I guess you mean the shell() command? Try this:

Private Sub Command1_Click()
    Dim a As String
    Dim l As Long
    a = "" & Form1.Text1.Text
    l = Shell(a, vbMaximizedFocus)
End Sub

It uses a button, named Command1, and on the Click event it reads Text1.Text into variable a, which is a string. This is passed to the shell() function to run the program in a Maximized Focus so you can see it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
R_N_WARDAuthor Commented:
You answer works, but I have a new prob.  My progam consits of Comand1 (dubed "run"), drive1, Text1, dir1 and file1. I want the user to be able to use the drive1, file1, and dir1 to select the file (*that is suposed to apper in text1*) and press run to, well, run the program. The file will not appear in Text1. Any helpful hints.
0
R_N_WARDAuthor Commented:
You answer works, but I have a new prob.  My progam consits of Comand1 (dubed "run"), drive1, Text1, dir1 and file1. I want the user to be able to use the drive1, file1, and dir1 to select the file (*that is suposed to apper in text1*) and press run to, well, run the program. The file will not appear in Text1. Any helpful hints.
0
R_N_WARDAuthor Commented:
see above
0
cable4096Commented:
Try this:

Private Sub Command1_Click()
    Dim a As String
    Dim l As Long
    Dim s_temp as String
    s_temp = "" & Form1.drive1 & Form1.dir1 & Form1.file1
    Form1.Text1.Text = s_temp
    a = "" & Form1.Text1.Text
    l = Shell(a, vbMaximizedFocus)
End Sub

That is assuming that the user uses all the right settings, as in:

drive1 = "C:\"
dir1 = "Windows\Command"
file1 = "edit"

Which would make s_temp as "C:\Windows\Command\edit"

Which Text1 gets set to.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.