Pass Error Code from a VBA module to the VBScript that executed it
<p>How can I successfully pass an error code from the VBA module in Part 2 to the VBScript that executed it in Part 1?</p>

<hr>

<p><strong>Part 1: VBScript that executes the VBA in Part 2</strong></p>

<pre><code>Option Explicit

  Dim xlApp 
  Dim xlBook

  If Err.Number &lt;&gt; 0 Then Err.Clear

  Set xlApp = GetObject("","Excel.Application")
  Set xlBook = xlApp.Workbooks.Open("\\(directory)\(File Name).xlsm", 0, True)
  xlApp.Run "(Macro Name)"
  If Err.Number &lt;&gt; 0 Then
      Msgbox Err.Number &amp; ": " &amp; Err.Description &amp; " The script will now quit."
      WScript.Quit
  Else
      Msgbox Err.Number
  End If
  xlApp.Quit
</code></pre>

<p><strong>Part 2: VBScript that executes the VBA in Part 2</strong></p>

<pre><code>Option Explicit

Sub (MacroName)()

            'Snip - A bunch of working code                

            Err.Number = 7
            Err.Description = "Made up error for testing - delete me"

End Sub
</code></pre>

<hr>

<p>When this script is run, Err.Number is 0 when tested, and the Msgbox simply displays <code>0</code>. What do I need to do to get it to display <code>7: Made up error for testing - delete me The script will now quit.</code></p>