Link to home
Start Free TrialLog in
Avatar of R_N_WARD
R_N_WARD

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of cable4096
cable4096

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 R_N_WARD
R_N_WARD

ASKER

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.
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.
see above
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.