title: Recordset: blank for string records?
body: <p>I have 2 excel workbooks and I am pulling data (A1:A20)from one (WB1) to another using below macro. I have problem that only records with numbers are pulled while string records are not. It seems that the field type is considered as a number and only numbers are being pulled. what should I change in the code to solve it?</p>
  
  <p>below link includes the source file:
  <a href="https://drive.google.com/open?id=0B64seB8-qtdLYk80N3hvX2F6VGc" rel="nofollow noreferrer">https://drive.google.com/open?id=0B64seB8-qtdLYk80N3hvX2F6VGc</a></p>
  
  <pre><code>Private Source As Variant
  
  Sub Copy_Paste()
  'copy the data from the source
  Source = ThisWorkbook.Path &amp; "\WB1.xlsx"
  GetData Source, "Sheet1", "A1:A20", Sheets("Database").Range("A1")
  End Sub
  
  Public Sub GetData(Source As Variant, SourceSheet As String, SourceRange As String, TargetRange As Range)
  Dim rsCon As Object
  Dim rsData As Object
  Dim szSQL As String
  Dim szConnect As String
  'Create the connection string based on excel version
      If Val(Application.Version) &lt; 12 Then
          szConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _
                      "Data Source=" &amp; Source &amp; ";" &amp; _
                      "Extended Properties=""Excel 8.0;HDR=No"";"
      Else
          szConnect = "Provider=Microsoft.ACE.OLEDB.12.0;" &amp; _
                      "Data Source=" &amp; Source &amp; ";" &amp; _
                      "Extended Properties=""Excel 12.0;HDR=No"";"
      End If
  szSQL = "SELECT * FROM [" &amp; SourceSheet$ &amp; "$" &amp; SourceRange$ &amp; "];"
  
  On Error GoTo SomethingWrong
  Set rsCon = CreateObject("ADODB.Connection")
  Set rsData = CreateObject("ADODB.Recordset")
  rsCon.Open szConnect
  rsData.Open szSQL, rsCon, 0, 1, 1
  ' Check to make sure we received data and copy the data
  If Not rsData.EOF Then
      TargetRange.Cells(1, 1).CopyFromRecordset rsData
  Else
      MsgBox "No records returned from : " &amp; Source, vbCritical
  End If
  ' Clean up our Recordset object.
  rsData.Close
  Set rsData = Nothing
  rsCon.Close
  Set rsCon = Nothing
  Exit Sub
  SomethingWrong:
      MsgBox "The file name, Sheet name is invalid of : " &amp; Source, vbExclamation, "Error"
  On Error GoTo 0
  End Sub
  </code></pre>