Просто сделать:
код заголовка ...
Set objMyConn = New ADODB.Connection
Set objMyCmd = New ADODB.Command Set
objMyRecordset = New ADODB.Recordset
On Error GoTo ERRORHAND
Рабочий код ...
objMyConn.ConnectionString = ConnStr
objMyConn.Open
код ....
'Копировать данные из Excel'
objMyConn.BeginTrans <-- define transactions to possible be rolled back
For NewRows = 2 To Rows
objMyRecordset.AddNew
For NewColumns = 0 To Columns - 1
objMyRecordset.Fields(NewColumns).Value = ActiveSheet.Cells(NewRows, NewColumns + 1)
Next NewColumns objMyRecordset.Update Next NewRows
objMyConn.CommitTrans <- if success, commit them to DB
objMyConn.Close
ERRORHAND:
Success = False
objMyConn.RollbackTrans <-- here we roll back if error encountered somewhere
LogMessage = "ERROR writing database: " & Err.Description
...