title: Passing a variable from vba to .bat file
body: <p>I'm trying to pass a variable from word VBA to a batch file. The variable is an input box that the user has to type their username into. The batch file is then supposed to take that username and check it against an AD group in our directory. I must present the variable in the VBA first as I need to manipulate it in the VBA script after the batch file runs (unless it would be easier to pass a batch variable into word vba). All of the research I've done leads me to something along these lines:</p>
  
  <pre><code>Dim val, r As String
  r = InputBox("Please enter your username:")
  val = "path\mybat.bat" &amp; r
  Call Shell(val, vbNormalFocus)
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>Dim val, r As String
  r = InputBox("Please enter your username:")
  val = "path\mybat.bat r"
  Call Shell(val, vbNormalFocus)
  </code></pre>
  
  <p>I keep getting a run-time error 53 in VBA. I'm also not sure how to call the variable once it's passed into the .bat file.</p>