Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to put result of shell function into variable

Status
Not open for further replies.

keith23

Technical User
May 26, 2005
97
NL
Hi all .I have difficulty outputing the value of shell function into massagebox using task_id variable. Currently the shell function writes the output to text file but i want put the value equal to variable but it never works!! I be happy if some expert help me.Thanks

Code:
Private Sub Reg(Path As String)

Dim task_id

task_id = shell("Regedit.exe /e " & Chr(34) & Path & Chr(34) & " " & Chr(34) & _
"HKEY_CURRENT_USER" & "\" & "Software\me\" & Chr(34))
'The Char For " is Chr(34)

MsgBox "shell function output: "+task_id

End Sub
 
As long as you are trying to read a value, something like the following might be a little more efficient:

task_id = CreateObject("wscript.shell").RegRead("HKLM\Software\me")
 
Thank strongm for u reply. I tried it and it does not work .This time it does not write it to a file eaither!! and the massage box never pops up!!
 
It isn't trying to write to a file. Nor does it display a messagebox; I thought I'd leave that up to you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top