title: SQL "Insert" in VBA code
body: <p>There is an issue (Type mismatch error) in the code below in the line:
  Action = ....</p>
  
  <p>I try to use Sql INSERT INTO to copy arrays from Excel and paste it into PostgreSQl database.</p>
  
  <pre><code>Sub UploadToDatamart2()
  
  'Defining connection objects
  Dim cnn As New ADODB.Connection
  Dim rst As New ADODB.Recordset
  Dim LastRow As Long
  
  Sheets("AVON DICTIONARY").Activate
  
  'Opening the ODBC connection
  cnn.Open "Driver={PostgreSQL Unicode(x64)};DSN=postgres;Server=XXX;Port=5432;UID=YYY;PWD=ZZZ;Database=hurtownia;READONLY=0;PROTOCOL=6.4;FAKEOIDINDEX=0;SHOWOIDCOLUMN=0;ROWVERSIONING=0;SHOWSYSTEMTABLES=1"
  
  'Find the last row
  With ActiveSheet
      LRow = .Cells(.Rows.Count, "A").End(xlUp).Row
  'Picking up cell values
      Category = .Range("A3:A" &amp; LRow).Value
      segment = .Range("B3:B" &amp; LRow).Value
      brand = .Range("C3:C" &amp; LRow).Value
  End With
  
  'Defining and executing SQL insert
  Action = "INSERT INTO temp.avon_dictionary_test" &amp; " VALUES ('{" &amp; Category &amp; "}','{" &amp; segment &amp; "}','{" &amp; brand &amp; "}')"
  Result = cnn.Execute(Action)
  
  cnn.Close
  End Sub
  </code></pre>
  
  <p>I would be glad if anyone could help</p>