createUndoTransaction Method

       

Creates an FPHTMLUndoTransaction object that allows you to cancel the specified transaction.

expression.createUndoTransaction(Title)

expression   Required. An expression that returns a DispFPHTMLDocument object.

Title  Required. A String that specifies the title of the FPHTMLUndoTransaction object.

Example

Use the createUndoTransaction method to create an UndoTransaction object. The following example creates an FPHTMLUndoTransaction object and prompts the user as to whether or not to cancel the operation.

Private Sub CreateTransaction()
    Dim objTrans As FPHTMLUndoTransaction
    Dim objDoc As FPHTMLDocument
    Dim objUTransName As String
    Dim strMsg As String
    Dim strAnswer as String

    Set objDoc = ActiveDocument
    objUTransName = "Undo Last Macro"
    Set objTrans = _
    objDoc.createUndoTransaction(objUTransName)
    strMsg = "Would you like to cancel the operation?"

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

    strAnswer = MsgBox(strMsg, vbYesNo, "Cancel Operation?")
    If strAnswer = vbYes Then
        objTrans.abort
    Else
        objTrans.commit
    End If
End Sub