Aeon 0 Report post Posted March 27, 2009 (edited) Hey,I was wondering that the appropriate syntax would be to have VB run an application when you hit 'okay' -- Meaning when you hit okay, it opens up notepad.exe or whatever.My current code is msgbox "Some message here", 0 I've tried adding Open="notepad.exe" on the next line, but it does not work. Any feedback would be greatly appreciated.-AE. Edited March 27, 2009 by Aeon (see edit history) Share this post Link to post Share on other sites
iXeta 0 Report post Posted March 27, 2009 It depends on what version of VB you're using. If your using VB.NET, use the line of code:Process.Start("Notepad.exe")That line of code, without giving the drive letter or folder information, will open a windows exe located in your system32 folder.To run a program other than a system32 application, use code similar to this:Process.Start("c:\folder\myapp.exe")These lines of code won't work if your using VB6. Share this post Link to post Share on other sites
Aeon 0 Report post Posted March 27, 2009 It depends on what version of VB you're using. If your using VB.NET, use the line of code:Process.Start("Notepad.exe")That line of code, without giving the drive letter or folder information, will open a windows exe located in your system32 folder.To run a program other than a system32 application, use code similar to this:Process.Start("c:\folder\myapp.exe")These lines of code won't work if your using VB6. Thank you.I am using VB6 though, so the code does not work. Would it be better to upgrade to .net? Share this post Link to post Share on other sites
iXeta 0 Report post Posted March 28, 2009 Thank you.I am using VB6 though, so the code does not work. Would it be better to upgrade to .net? If you're using VB6, use this code instead.Dim ReturnValReturnVal = Shell("C:\WINDOWS\System32\notepad.exe", 1)With VB6, you need the entire URL to the EXE even with system32 processes. I've forgotten some of my version 6 knowledge, but I do believe the 1 after the exe name is for when your handling multiple processes, you change the number incrementally. I may be wrong on that though. Share this post Link to post Share on other sites
Aeon 0 Report post Posted March 28, 2009 If you're using VB6, use this code instead.   Dim ReturnVal  ReturnVal = Shell("C:\WINDOWS\System32\notepad.exe", 1)   With VB6, you need the entire URL to the EXE even with system32 processes. I've forgotten some of my version 6 knowledge, but I do believe the 1 after the exe name is for when your handling multiple processes, you change the number incrementally. I may be wrong on that though. Hmm---It's giving me an error with that code--   msgbox "Messagehere", 0Dim ReturnValReturnVal = Shell("C:\WINDOWS\System32\notepad.exe", 1) Error Information: Line 4 Char 1 Error: Type mismatch: 'Shell' Code: 800A000D Source: Microsoft VBScript runtime error.  I should note that I'm coding this with notepad. Share this post Link to post Share on other sites
iXeta 0 Report post Posted March 28, 2009 Are you using VB6 or VBScript? There is a difference.If your coding this in notepad, im assuming your using VBScript? In that case im not sure how to Shell an application =/ sorry. Share this post Link to post Share on other sites
Aeon 0 Report post Posted March 28, 2009 Yes, I am using VBScript. When I save the note pad file, I save it as 'file.vbs.' Share this post Link to post Share on other sites
darasen 0 Report post Posted April 14, 2009 (edited) I am not sure if this has been resolved yet or not. But for the sake of anyone searching the topic here is a resolution. This is VB Script. Set objShell = CreateObject("WScript.Shell")objShell.Run "%windir%\Notepad.exe" If you are using the option explicit you have to add the line :dim objShell first to declare the variable. Hope this helps someone. Edited April 14, 2009 by darasen (see edit history) Share this post Link to post Share on other sites
iGuest 3 Report post Posted October 12, 2009 retrieve msgbox textMsgbox Question.I was wondering if anyone knows how to retrieve the text from a msgbox from another process?Is there a "Get" statement that I can use? -reply by mark Share this post Link to post Share on other sites