Dim objTxCtx As TransactionContext
Dim objMyObject As MyCompany.MyObject
Dim userCanceled As Boolean
' Get TransactionContext.
Set objTxCtx = _
CreateObject("TxCtx.TransactionContext")
' Create an instance of some component.
Set objMyObject= _
objTxCtx.CreateInstance("MyCompany.MyObject")
' Do some work here.
' If something goes wrong, abort the transaction.
If userCanceled Then
objTxCtx.Abort
' Otherwise, commit it.
Else
objTxCtx.Commit
End If