From: Steve on 18 Dec 2009 11:36 I am not sure what is going on with this so I am not sure what to ask. I'll just share my experience and maybe somebody can point out what I am doing wrong. I am attempting to launch another application from my VB app. The code to launch the other app is just a simple shell call (lngProcID = Shell(strAppPath)). The call to Shell does return a value but the app does not appear to have been started (does not show up visually and is not in task manager). Using the value held in strAppPath in the Run dialog (Start->Run) starts the app just fine. I figure this has to be some stupid oversite on my part but I can not find it...anybody got any ideas? Thanks, Steve
From: MikeD on 18 Dec 2009 12:10 "Steve" <sredmyer(a)yahoo.com> wrote in message news:cf894b17-df7b-4447-8748-bca05ab7228d(a)u7g2000yqm.googlegroups.com... > I am not sure what is going on with this so I am not sure what to > ask. I'll just share my experience and maybe somebody can point out > what I am doing wrong. I am attempting to launch another application > from my VB app. The code to launch the other app is just a simple > shell call (lngProcID = Shell(strAppPath)). The call to Shell does > return a value but the app does not appear to have been started (does > not show up visually and is not in task manager). Using the value > held in strAppPath in the Run dialog (Start->Run) starts the app just > fine. > > I figure this has to be some stupid oversite on my part but I can not > find it...anybody got any ideas? You should state exactly what the command line is that you're using. The Shell function can only run executable files. Typically, these are files with EXE, COM, and BAT extensions. By default, Windows treats some extensions for scripting as executable files, but I always remove these extensions. So, if you're specifying a document file and trying to open that file in its associated application, you can't use the Shell function. You can use the ShellExecute Win32 API function though. -- Mike
From: Steve on 18 Dec 2009 12:31 On Dec 18, 12:10 pm, "MikeD" <nob...(a)nowhere.edu> wrote: > "Steve" <sredm...(a)yahoo.com> wrote in message > > news:cf894b17-df7b-4447-8748-bca05ab7228d(a)u7g2000yqm.googlegroups.com... > > > I am not sure what is going on with this so I am not sure what to > > ask. I'll just share my experience and maybe somebody can point out > > what I am doing wrong. I am attempting to launch another application > > from my VB app. The code to launch the other app is just a simple > > shell call (lngProcID = Shell(strAppPath)). The call to Shell does > > return a value but the app does not appear to have been started (does > > not show up visually and is not in task manager). Using the value > > held in strAppPath in the Run dialog (Start->Run) starts the app just > > fine. > > > I figure this has to be some stupid oversite on my part but I can not > > find it...anybody got any ideas? > > You should state exactly what the command line is that you're using. The > Shell function can only run executable files. Typically, these are files > with EXE, COM, and BAT extensions. By default, Windows treats some > extensions for scripting as executable files, but I always remove these > extensions. So, if you're specifying a document file and trying to open that > file in its associated application, you can't use the Shell function. You > can use the ShellExecute Win32 API function though. > > -- > Mike Here is my exact code Dim strAppPath As String strAppPath = "C:\Program Files\Aspect Software\Unified IP \M3Designer\CrtoGDEFramework.exe" lngPocID = Shell(strAppPath, vbNormalFocus) As I say if I simply place the string "C:\Program Files\Aspect Software \Unified IP\M3Designer\CrtoGDEFramework.exe" (without quotes) in the run dialog the applications starts as expected. Thanks, Steve
From: Nobody on 18 Dec 2009 12:50 "Steve" <sredmyer(a)yahoo.com> wrote in message news:cf894b17-df7b-4447-8748-bca05ab7228d(a)u7g2000yqm.googlegroups.com... >I am not sure what is going on with this so I am not sure what to > ask. I'll just share my experience and maybe somebody can point out > what I am doing wrong. I am attempting to launch another application > from my VB app. The code to launch the other app is just a simple > shell call (lngProcID = Shell(strAppPath)). The call to Shell does > return a value but the app does not appear to have been started (does > not show up visually and is not in task manager). Using the value > held in strAppPath in the Run dialog (Start->Run) starts the app just > fine. > > I figure this has to be some stupid oversite on my part but I can not > find it...anybody got any ideas? Use Process Explorer instead of Task Manager. If the process started and immediately exited for some reason, it would show up in Process Explorer for at least a second or two. Also, if the path contain spaces, surround it by double quotes. Example: lngProcID = Shell(Chr(34) & strAppPath & Chr(34)) Or as some prefer: lngProcID = Shell("""" & strAppPath & """") The later is faster because it's evaluated at compile time, while the former makes a function call to Chr(), which is slower but it's easier to read. The 4 double-quote char represent a single double-quote. The outer two are used to surround the string and the second in the sequence is used as a escape char. Try using Debug.Print to see the exact string that is passed.
From: Rick Rothstein on 18 Dec 2009 12:53
Just guessing here, but give this a try for your Shell line and see if it works... lngPocID = Shell("""" & strAppPath & """", vbNormalFocus) -- Rick (MVP - Excel) "Steve" <sredmyer(a)yahoo.com> wrote in message news:fa295f7a-2cc2-4e44-802d-89ea54db47ae(a)y24g2000yqb.googlegroups.com... On Dec 18, 12:10 pm, "MikeD" <nob...(a)nowhere.edu> wrote: > "Steve" <sredm...(a)yahoo.com> wrote in message > > news:cf894b17-df7b-4447-8748-bca05ab7228d(a)u7g2000yqm.googlegroups.com... > > > I am not sure what is going on with this so I am not sure what to > > ask. I'll just share my experience and maybe somebody can point out > > what I am doing wrong. I am attempting to launch another application > > from my VB app. The code to launch the other app is just a simple > > shell call (lngProcID = Shell(strAppPath)). The call to Shell does > > return a value but the app does not appear to have been started (does > > not show up visually and is not in task manager). Using the value > > held in strAppPath in the Run dialog (Start->Run) starts the app just > > fine. > > > I figure this has to be some stupid oversite on my part but I can not > > find it...anybody got any ideas? > > You should state exactly what the command line is that you're using. The > Shell function can only run executable files. Typically, these are files > with EXE, COM, and BAT extensions. By default, Windows treats some > extensions for scripting as executable files, but I always remove these > extensions. So, if you're specifying a document file and trying to open > that > file in its associated application, you can't use the Shell function. You > can use the ShellExecute Win32 API function though. > > -- > Mike Here is my exact code Dim strAppPath As String strAppPath = "C:\Program Files\Aspect Software\Unified IP \M3Designer\CrtoGDEFramework.exe" lngPocID = Shell(strAppPath, vbNormalFocus) As I say if I simply place the string "C:\Program Files\Aspect Software \Unified IP\M3Designer\CrtoGDEFramework.exe" (without quotes) in the run dialog the applications starts as expected. Thanks, Steve |