title: Replace SQL command text in data connection in Excel
body: <p>Is there a way to replace the SQL command text in the data connection in Excel via VBA?</p>
  
  <p>For example, I have a data connection named "Accounts" and it has a simple query in the command text that states</p>
  
  <pre><code>Select a.* 
  from Recon a 
  where a.recon in 
  ('12345','67890')
  </code></pre>
  
  <p>I have the SQL statement built in a sheet1 (cell A2 through cell A5) that allows users to enter different "recon" numbers. Instead of them having to copy and paste this into the command text in the data connection.  I want to be able to have a macro that copies and paste the SQL from cell A2 through cell A5 into the command text in the data connection and then refresh the data connection which is connected to Table1.</p>