Sub 插入()
Set con = CreateObject("adodb.connection")
Set wbsht = ThisWorkbook.Sheets(1)
con.Open "provider=microsoft.ace.oledb.12.0;extended properties=excel 12.0;" _
& "data source=\\10.150.231.100\SHAT_Share_Folder\03_ENG\05_Share Folder\CP Team\小程序\TCM_record.xlsx"
'Sql = "insert into [Sheet1$a1:o] values (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)" 用这段成功了
Sql = "insert into [Sheet1$a1:o] values (" & wbsht.Cells(2, 2) & ",2,3,4,5,6,7,8,9,10,11,12,13,14,15)" ‘这段不行,有老师看看原因么
con.Execute Sql
wbsht.Cells(2, 2)这个单元格是文本,我用单引号也不行
Sql = "insert into [Sheet1$a1:o] values (’" & wbsht.Cells(2, 2) & "‘,2,3,4,5,6,7,8,9,10,11,12,13,14,15)" |