title: Passing a parameter to a subroutine
body: <p>I have a powerpoint file with the following macro:</p>
  
  <pre><code>Sub test(msg$)
      MsgBox msg
  End Sub
  </code></pre>
  
  <p>I have a vbscript file that looks like this:</p>
  
  <pre><code>Option Explicit
  On Error Resume Next
  RunMacro
  
  Sub RunMacro()
  
      Set ppApp = CreateObject("Powerpoint.Application")
      Set ppPres = ppApp.Presentations.Open("test.pptm", 1)
  
      ppApp.Run "test.pptm!test ""my message here"" "
  
      ppApp.Quit
  
      Set ppPres = Nothing
      Set ppApp = Nothing
  End Sub
  </code></pre>
  
  <p>But I can't seem to pass the string parameter to the macro (no message box shows up in PPT). I'm guessing something is wrong with the number of quotation marks, but I've tried every permutation I could think of and nothing works. If I hard-code the message in the macro everything works fine.</p>
  
  <p>Related (tried these, with no luck)</p>
  
  <p><a href="https://stackoverflow.com/questions/15025843/vbscript-how-to-call-run-with-parameters">How to call Run() with parameters</a></p>
  
  <p><a href="https://stackoverflow.com/questions/17566540/vbscript-shell-run-with-arguments">Shell.Run with arguments</a></p>