createUndoTransaction Method

Microsoft FrontPage Visual Basic

createUndoTransaction Method

Creates a new instance of an FPHTMLUndoTransaction object for the specified document.

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.

Remarks

An FPHTMLUndoTransaction object allows you to track every action that occurs (after the undo transaction stack is created). You can then use the programming elements provided in the Page object model at run-time to track the actions of a macro.

Example

Use the createUndoTransaction method of the FPHTMLDocument, IFPDocument, and IHTMLDocument objects to create an FPHTMLUndoTransaction object. The String argument passed in with the createUndoTransaction method is added to the Undo command on the Edit menu when the Commit method is called. The following example creates an FPHTMLUndoTransaction object illustrating the abort and Commit methods.

    Private Sub CreateUndoTransaction()
    Dim objDoc As FPHTMLDocument
    Dim objTansaction As FPHTMLUndoTransaction
    
    On Error GoTo CreateUndoTransactionError
    
    Set objDoc = ActiveDocument
    Set objTansaction = objDoc _
        .CreateUndoTransaction("Last Macro")
    
    objDoc.body.insertAdjacentHTML "BeforeEnd", _
        "<b>Added by FP Programmability</b>"
    
    objTansaction.Commit

ExitCreateUndoTransaction:
    Exit Sub
    
CreateUndoTransactionError:
    objTansaction.abort
    GoTo ExitCreateUndoTransaction
End Sub