title: How do you run a .exe with parameters using vba's shell()?
body: <p>I have a target file path that is structured like example below.</p>
  
  <pre><code>C:\Program Files\Test\foobar.exe /G
  </code></pre>
  
  <p>What I need to do is be able to execute this file using VBA's <code>shell()</code> command.</p>
  
  <p>How do I have to format the file path to tell <code>Shell()</code> that there is an argument that it needs to call along with running the .exe</p>
  
  <p>What I've read/tried (with no avail) is below with the results to the right.</p>
  
  <pre><code>file = """C:\Program Files\Test\foobar.exe"" /G"    &lt;---Bad file name or number (Error 52) 
  shell(file)
  
  file2 = "C:\Program Files\Test\foobar.exe /G"       &lt;---file never found
  shell(file2)
  </code></pre>
  
  <p>I've succeeded with running other .exe's using shell() so I know it's not a problem with VBA or the function.</p>
  
  <p>Example:</p>
  
  <pre><code>works = "C:\Program Files\Test\test.exe"
  shell(works)
  </code></pre>
  
  <p>I'm not particularly familiar with the process involved with executing files that require additional parameters so if I misspeak or you need more information, please let me know.</p>