melvincast
New Member
- Joined
- Jun 9, 2015
- Messages
- 3
Hello, im new using a Excel VBA, im working with listobjects and i want to insert a excel table to SQL server table, i have the connection already, some help pls
Code:
Public Function RecordsetFromSheet
Dim cn As Object
Set cn = CreateObject("ADODB.Connection")
cn.ConnectionString = OleDbConnectionString("xxxxx", "xxxx", "xxx", "xxxx")
cn.Open
If CBool(cn.State And adStateOpen) = True Then cn.Close
Set cn = Nothing
End If
cn.Close
Set cn = Nothing
End Function