title: How to Write a VBA Shell Script to Run a PHP Script on Variable Files
body: <p>I'm trying to write a shell script that will run a PHP script on a number of files at once (this requires using an exe file and a php file on a json file). The json file is the only one that is variable in this situation.</p>
  
  <p>If I were using the command prompt manually, here's the command I would need to input to achieve the desired result-</p>
  
  <pre><code>C:/Users/myusername/Desktop/XAMPP/php/php.exe transcript.php transcribedfile.json
  </code></pre>
  
  <p>Cell G2 of my worksheet contains the json filename, so that's why I've activated it in the second line. Once I can get the shell script to work I will code in a loop that will cycle through all values in the G column, beginning with G2, until the ActiveCell value is "".</p>
  
  <p>Here's what I've tried-</p>
  
  <pre><code>Sub Shell()
  Range("G2").Activate
  Dim strProgramName As String
  Dim strArgument As String
  
  strProgramName = "C:\Users\myusername\Desktop\XAMPP\php\php.exe transcript.php " &amp; ActiveCell.Value
  strArgument = "/G"
  
  Call Shell("""" &amp; strProgramName &amp; """ """ &amp; strArgument &amp; """", vbNormalFocus)
  
  End Sub
  </code></pre>
  
  <p>When I run the sub I get a "File Not Found" error. I tested strProgramName and found that I could get php.exe to run if I cut the code off at that point, but I would need it to recognize the whole string.</p>
  
  <p>Any ideas would be welcome. Thank you in advance.</p>