Segue:
Public Sub insert_dados()
Dim connectionString As String
connectionString = ThisWorkbook.Path & "/database1.mdb"
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
sql = "INSERT INTO Feedback ( Usuario,Agente,Data,Tipo,Feedback) VALUES( '" & UserForm1.txt_user.Value & "','" & UserForm1.CB_AGENTE.Value & "','" & UserForm1.CB_TIPO.Value & "','" & UserForm1.txt_data.Value & "','" & UserForm1.TXT_FEEDBACK.Value & "')"
' Cria o objeto Connection.
Set conn = New ADODB.Connection
With conn
' Define o provedor OleDB para a conexão.
.Provider = "Microsoft.JET.OLEDB.4.0"
' Abre uma conexão com o Northwind.mdb.
.Open connectionString '
End With
Set rst = New ADODB.Recordset
With rst
.ActiveConnection = conn
.Open sql, conn, adOpenDynamic, adLockBatchOptimistic
End With
Set rst = Nothing
conn.Close
End Sub
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 26/10/2010 11:32 am