title: EXCEL VBA: trying to write a table in MySQL Database
body: <p>I´m trying to write a table into a MySQL Database, ich searched for many Examples but id didn´t working and i hav no idea why.</p>
  
  <p>my Code:</p>
  
  <pre><code>    Private Sub abfrage()
  
  Dim xlsstring As String
  Dim xlsrecordsetarray
  Dim xlsadodbconnection As New ADODB.Connection
  Dim xlsrecordset As New ADODB.Recordset
  Dim xlssource As String
  Dim xlsconnect As String
  
  Dim sqlstring As String
  Dim sqlrecordsetarray
  Dim sqladodbconnection As New ADODB.Connection
  Dim sqlrecordset As New ADODB.Recordset
  Dim sqlsource As String
  Dim sqlconnect As String
  
  xlssource = ThisWorkbook.FullName
  'xlssource ="C:\mappe1.xls"
  
  'SQL Verbindung für Exceldatei als Quelle
  xlsconnect = "PROVIDER=MSDASQL.1;" &amp; _
              "DSN=Excel Files;" &amp; _
              "DBQ=" &amp; xlssource &amp; ";" &amp; _
              "HDR=Yes;"
  
  
  sqlconnect = "DRIVER={MySQL ODBC 5.3 Driver};" &amp; _
              "DATA SOURCE=MySQL ODBC;" &amp; _
              "SERVER=localhost;" &amp; _
              "PORT=3306;" &amp; _
              "UID=root;" &amp; _
              "PWD=root;" &amp; _
              "DATABASE=test;"
  
  xlsadodbconnection.Open xlsconnect
  sqladodbconnection.Open sqlconnect
  
  sqlstring = "INSERT INTO test (ID, text) SELECT id, text FROM [Tabelle1$]"
  sqlrecordset.Open sqlstring, sqladodbconnection
  
  xlsrecordset.Close
  xlsadodbconnection.Close
  sqladodbconnection.Close
  
  End Sub
  </code></pre>
  
  <p>it shows me the error:</p>
  
  <p>[MySQL[ODBC 5.3(w) Driver][mysqld-5.6.16]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[Tabelle1$]' at Line 1</p>
  
  <p>please, can anyone help me?</p>
  
  <p>Thanks</p>