Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The MSDN page on <a href="http://msdn.microsoft.com/en-us/library/e8zac0ca.aspx" rel="noreferrer">Process.Start()</a> states that this method has an overload of type Boolean, where the return values mean:</p> <blockquote> <p>true if a process resource is started; false if no new process resource is started (for example, if an existing process is reused).</p> </blockquote> <p>Additionally it can throw three exceptions:</p> <ul> <li>InvalidOperationException</li> </ul> <p>No file name was specified in the Process component's StartInfo.</p> <p>-or- </p> <p>The ProcessStartInfo.UseShellExecute member of the StartInfo property is true while ProcessStartInfo.RedirectStandardInput, ProcessStartInfo.RedirectStandardOutput, or ProcessStartInfo.RedirectStandardError is true. </p> <ul> <li>Win32Exception</li> </ul> <p>There was an error in opening the associated file. </p> <ul> <li>ObjectDisposedException</li> </ul> <p>The process object has already been disposed. </p> <hr> <p>To use this overload of Process.Start() (which is the only non static overload of the method) you need to create an instance of the Process class using a ProcessStartInfo object. </p> <p>An example of this is below:</p> <pre><code>ProcessStartInfo processStartInfo = new ProcessStartInfo("EXCEL.EXE"); Process process = new Process(); process.StartInfo = processStartInfo; if (!process.Start()) { // That didn't work } </code></pre> <p>Though, given that this can still throw you are probably better of just wrapping a catch around one of the static .Start() method calls.</p> <hr> <p>Given that, it seems clear that the call to Process.Start() will either work or not and you can determine this from the return value being 0 (or an exception being thrown).</p> <p>Once your process has started you then have a lot of control over things, with properties of the Process class such as HasExited allowing you to check what state the process is in.</p> <p>In short - if the user does not have excel on their machine, Process.Start() will throw an exception.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload