createUndoTransaction Method

       

Creates a new instance of an FPHTMLUndoTransaction object for the specified document. An UndoTransaction object provides a tracking mechanism for every action that occurs (after the undo transaction stack was created). You can then use the programming elements provided in the Page object model at run-time to track the actions of a macro.

expression.createUndoTransaction(title)

expression   An expression that returns an FPHTMLDocument, IFPDocument, or IHTMLDocument object.

title   Required String. The string that represents the title of the FPHTMLUndoTransaction object and appears on the Undo portion of the Edit menu.

Return Type

Object

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