commit Method

       

Executes the UndoTransaction object for the series of operations that was added to the undo stack since the time that the UndoTransaction object was created. For example, if you created an UndoTransaction object, and then ran a macro, the commit method allows the macro to continue or, if the macro is finished, the commit method prevents the roll back of the effects of the macro. In other words, the series of operations for the macro are committed and cannot be rolled back.

expression.commit

expression   An expression that returns a FPHTMLUndoTransaction object.

Return Type

Void

Example

The following example creates a transaction, performs an operation that adds the operation to the stack, and then requires a response from the user that either aborts the operation or commits it.

Private Sub CreateTransaction()
Dim myTrans As FPHTMLUndoTransaction
Dim myDoc As FPHTMLDocument
Dim myUTransName As String
Dim myMsg As String

Set myDoc = ActiveDocument
myUTransName = "Undo Last Macro"
Set myTrans = _
    myDoc.createUndoTransaction(myUTransName)
myMsg = "Would you like to cancel the operation?"

Call myDoc.body.insertAdjacentHTML("BeforeEnd", _
    "<b> Added by FP Programmability </b>")

Answer = MsgBox(myMsg, vbYesNo, "Cancel Operation?")
If Answer = vbYes Then
    myTrans.abort
Else
    myTrans.commit
End If
End Sub