# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  How to start an application from Excel VBA

## NoSpam@aol.com

I would like to start an application from Excel VBA and pass command line
parameters to it.  Once the app is started it should run completely
independently from the instance of Excel that started it.

Excel shouldn't wait on it to to anything (including terminate).

Thanks.

----------


## Chip Pearson

See the Shell statement.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


<NoSpam@aol.com> wrote in message
news:7i1b32htj314cn5ghlgmquiharuloasmj9@4ax.com...
>I would like to start an application from Excel VBA and pass
>command line
> parameters to it.  Once the app is started it should run
> completely
> independently from the instance of Excel that started it.
>
> Excel shouldn't wait on it to to anything (including
> terminate).
>
> Thanks.

----------


## NoSpam@aol.com

Thanks, I haven't tried it yet but it looks like exactly what I needed.  I
tried "Spawn", "Execute", "Start" and several others, but I didn't think to
look up "Shell".

On Thu, 6 Apr 2006 17:15:48 -0500, "Chip Pearson" <chip@cpearson.com>
wrote:

>See the Shell statement.

----------


## JWM6

The VBA shell command is as follows:

programPath = "C:\Program Files\Internet Explorer\iexplore.exe" ' works
'programPath = "iexplore.exe" ' does not work
Shell programPath + " " + fileToLaunch, vbNormalFocus

but the drawback is that the invoked program (iexplore.exe, at least in my case) needs to have the FULL PATH to where the program exists = the "C:\Program Files\Internet Explorer" which may or may not work on someone elses computer.  Is there a trick to find where the executing program lives? This hardcoding will not work and is not transportable.

Thanks,

----------


## JWM6

Got the answer from this post
http://www.excelforum.com/showthread.php?t=532972

----------


## derwildemann

I'm trying to get this shell function working but w/o the desired success:

that's my code:

Sub runSubMagic()
    programPath = "D:\Program Files\Video\SubMagic5-8\subMagic"
    fileToLaunch = "H:\VIDEO\MOVIES\movies 2010\movieTitle" & "\" & "movieTitle.en.srt"
    Shell programPath + " " + fileToLaunch, vbNormalFocus
End Sub

It starts the application but does not load the file "movieTitle.en.srt". I have tried this:
    programPath = """" & "D:\Program Files\Video\SubMagic5-8\subMagic" & """"
    fileToLaunch = """" & "H:\VIDEO\MOVIES\movies 2010\movieTitle" & """" & "\" & "movieTitle.en.srt" 

but it doesn't help either. Executing the code step by step also does not create an error whatsoever.

Any idea what might be wrong?

----------

