title: VBA to build blank Connection in Excel
body: <p>I am trying to build a blank SQL connection in Excel that will be updated with a connection string and command text a later point in the report.</p>
  
  <p>Code I am trying to use:</p>
  
  <p><code>Workbooks("WorkBook1.xlsm").Connections.Add2 "Test1", "Test1", " ", " ", "SQL"</code></p>
  
  <p>Syntax from Microsoft:</p>
  
  <pre><code>Add2 (string Name, string Description, object ConnectionString, object CommandText, object lCmdtype, object CreateModelConnection, object ImportRelationships);
  </code></pre>
  
  <p>However, I am struggling with the syntax as I keep getting errors.</p>
  
  <p>Any ideas?</p>