title: VBA For Excel AfterRefresh Event
body: <p>I am using the following QueryTable Inquiry. After the <code>.Refresh</code> executes the VBA procedure ends.  The inquiry works but I need to execute code after it completes.</p>
  
  <p>The <code>.AfterRefresh</code> event seems to be what I need, but I can't get it to execute. </p>
  
  <pre><code>With ActiveSheet.QueryTables.Add(Connection:="URL;" &amp; sUrl, Destination:=ActiveSheet.Range("a1"))
  
               .RefreshStyle = xlOverwriteCells
               .SaveData = True
               .Refresh
               .AfterRefresh (Success)
  End With
  </code></pre>
  
  <p>This is the AfterRefresh sub that does not execute.</p>
  
  <pre><code>Sub QueryTable_AfterRefresh(Success As Boolean)
  
          If Success Then
                   Debug.Print "Success"
          Else
                   Debug.Print "Failed"
          End If
  End Sub
  </code></pre>
  
  <p>What is needed to trigger the subroutine after the query is done? I tried a call to the subroutine after the <code>.Refresh</code> and after the End With but neither worked.  </p>
  
  <p>Thanks.</p>