title: Forcing ignoring errors from ADODB to Excel VBA
body: <p>I don't know if this is possible, but I figured I'd ask.</p>
  
  <p>Is there an equivalent to <code>On Error GoTo Next</code> for ADODB connections in Excel VBA?</p>
  
  <p>I have a stored procedure I'm calling using an ADODB.Command object.  The problem is, if any one statement in that stored procedure throws an error, the entire process gets shut down.  Yes, that's appropriate in some cases, but in my case, it's not a big deal, I'd just like it to continue executing the rest of the stored procedure anyway.</p>
  
  <p><code>On Error GoTo 0</code> shows the SQL error message and gives options to "End" or "Debug".</p>
  
  <p><code>On Error Resume Next</code> skips the SQL error message, but silently cancels the SQL command and moves the next VBA statement.</p>
  
  <p>Any ideas?</p>
  
  <p><b>EDIT:</b> I've had a request for my code.  I'm not sure it will help you much, but here:</p>
  
  <pre><code>On Error GoTo 0
  
  ServerConnection.Open "Provider=MSDASQL.1;Persist Security Info=True;Extended Properties="DRIVER=SQL Native Client;Trusted_Connection=Yes;SERVER=DBServer;DATABASE=Database";"
  
  Dim SqlCommand As ADODB.Command
  Set SqlCommand = New ADODB.Command
  
  With SqlCommand
      .ActiveConnection = ServerConnection
      .CommandText = "EXEC CacheTables @CacheTableType1=True"
      .CommandType = adCmdText
      .Execute
  End With
  
  ServerConnection.Close
  
  Set SqlCommand = Nothing
  Set ServerConnection = Nothing
  </code></pre>
  
  <p>I don't really control the stored procedure, unfortunately, but the reason it's throwing errors is that the person who wrote it used RAISERROR statements to tell the user where the execution is up to.  This is fine in SQL Server, which understands the "Priority" flag and hence continues executing, but VBA appears to consider all errors to be the same importance.</p>