Forum Moderators: open
Dim Conn1 As ADODB.Connection
Dim Cmd1 As ADODB.Command
Dim Rs1 As ADODB.Recordset
Dim strTmp As String
Dim sConnect As String
Dim sSp As String sConnect = "driver={sql server};" & _
"server=#*$!#*$!x;" & _
"Database=xxxxxxx;UID=xxxxxxx;PWD=xxxxxxx;"
sSp = "INSERT INTO Authors(au_fname) VALUES (" & CELLS(1,1).Value &")"
Set Conn1 = New ADODB.Connection
Conn1.ConnectionString = sConnect
Conn1.Open
Set Cmd1 = New ADODB.Command
Cmd1.ActiveConnection = Conn1
Cmd1.CommandText = sSp
Cmd1.CommandType = adCmdText ' adCmdStoredProc if it's a stored procedure
Set Rs1 = Cmd1.Execute()
Conn1.Close
Set Cmd1 = Nothing
Set Rs1 = Nothing
Set Conn1 = Nothing
HTH,
mark