title: Pass variable value to batch file
body: <p>Can't pass the variable value to a batch file:</p>
  
  <p>VBA code executed when clicked on an Access 2007 form button.</p>
  
  <pre><code>Private Sub OpenWB(var1 As String)
      Dim RetVal
      RetVal = Shell("S:\WildlifeHealth\Idaho\Incoming\test.bat var1", vbNormalFocus)
  End Sub
  </code></pre>
  
  <p>Code from sub routine that calls OpenWB:</p>
  
  <pre><code>idahofile = "S:\WildlifeHealth\Idaho\Incoming\test.xls”
  Call OpenWB(idahofile)
  </code></pre>
  
  <p>test.bat file:</p>
  
  <pre><code>Call %1
  </code></pre>
  
  <p>Returns “var1” instead of "S:\WildlifeHealth\Idaho\Incoming\test.xls”</p>
  
  <p>If test.bat file:</p>
  
  <pre><code>Call S:\WildlifeHealth\Idaho\Incoming\test.xls, file opens.
  </code></pre>
  
  <p>So how can I pass the value of var1 instead of the name var1.</p>
  
  <p>I am trying to find a work around to Access keeping a process of excel running in the process window after the user closes excel. It is not closed programmatically through VBA. I thought if I could pass the pathname that was selected in a dialog box in Access to a batch file and open it there (hence not from Access but the command line), my problem would be solved. But alas, I can’t seem to pass the variable value.</p>
  
  <p>Ideas anyone? </p>
  
  <p>Perhaps there is another programming language that can handle this issue? </p>