title: VBA SAP occasional error Control ID Not Found
body: <p>In the below code I am extracting data from SAP. In a few SAP reports I am running, occasionally data is not available, in which a pop up box appears, displaying</p>
  <blockquote>
  <p>No Data Exists For Chosen Selection</p>
  </blockquote>
  <p>I've implemented the below error handling strategy, which works fine when debugging and stepping into the code, but running in totality I receive this error on the asterik denoted line:</p>
  <blockquote>
  <p>The Control Could Not Be Found By ID</p>
  </blockquote>
  <pre><code>session.findById(&quot;wnd[0]/tbar[1]/btn[8]&quot;).press
  
  On Error GoTo ResumeInterCompany
  **If session.findById(&quot;wnd[1]/tbar[0]&quot;).Text = &quot;No data exists for chosen selection&quot; Then**
  GoTo TroubleShootInterCompany
  
  End If
  </code></pre>
  <p>Any suggestions. I can provide more relevant code if need be.</p>