从SQLite Databae导入文本到excel

时间:2017-12-29 16:38:18

标签: excel vba sqlite

我正在尝试从SQLite数据库sms.db导入,它适用于Type=INTEGER like date or handle_id但不适用于type=TEXT like text from message table

Sub GetSQLite()

Dim conn As Object, rst As Object

Set conn = CreateObject("ADODB.Connection")
Set rst = CreateObject("ADODB.Recordset")

' OPEN CONNECTION

conn.Open "DRIVER=SQLite3 ODBC Driver;Database=C:\SQLite3\sms.db;"

strSQL = "SELECT handle_id ,  is_from_me ,  ***text*** , date , date_read FROM message;"

' OPEN RECORDSET
rst.Open strSQL, conn

' OUTPUT TO WORKSHEET
Worksheets("Feuil1").Range("A1").CopyFromRecordset rst
rst.Close

' FREE RESOURCES
Set rst = Nothing: Set conn = Nothing

End Sub

0 个答案:

没有答案