title: Unable to connect to Teradata from excel using VBA code - Teradata Server can't be reached over the network
body: <p>I have been trying to connect to Teradata from Excel using vba code but I am getting the below mentioned error:
  Teradata Server can't be reached over the network. I have been able to successfully connect from Teradata SQL assistant and I also successfully pinged the Teradata server(I am using Teradata express edition in my laptop which runs on VMware player). I also successfully connected to Teradata from Excel Data connection wizard and Microsoft query. I have also switched off the firewall and checked to see If I am able to connect but still no luck in connecting. Please let me know where I am going wrong.</p>
  
  <p>Please find below code:</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  Dim conn As ADODB.Connection
  Dim rec1 As ADODB.Recordset
  Dim thisSql As String
  
  Set conn = New ADODB.Connection
  
  conn.Open "Driver=Teradata;DBCName=dsnname;Databasename=dbname;Uid=Userid;Pwd=****;"
  
  thisSql = "sel * from customer_db.customer"
  
  Set rec1 = New ADODB.Recordset
  rec1.Open thisSql, conn
  
  With Sheet1.QueryTables.Add(Connection:=rec1, Destination:=Sheet2.Range("A1"))
      .Name = "data"
      .FieldNames = True
      .Refresh BackgroundQuery:=False
  End With
  End Sub
  </code></pre>