Table of contents
TOC
Collapse the table of content
Expand the table of content

Application.OpenUndoTransaction Method (Project)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Create an undo transaction set for a series of operations.

Syntax

expression. OpenUndoTransaction( ** Label, ** guid )

expression A variable that represents an Application object.

Parameters

NameRequired/OptionalData TypeDescription
LabelRequiredStringName that appears in the drop-down list for the Undo Transaction command.
guidOptionalVariantGUID that uniquely identifies Label.

Remarks

The OpenUndoTransaction method is used in conjunction with CloseUndoTransaction method. You can use OpenUndoTransaction and CloseUndoTransaction on a single command or on a group of commands.

You cannot nest one undo transaction within another.

Example

The following example demonstrates using the OpenUndoTransaction method to create an undo transaction set. After you run the macro, the task named Task outside transaction shows as the item Insert Task in the Undo drop-down list on the Quick Access Toolbar. The six tasks named UndoMe 1 to UndoMe 6 show as Create 6 tasks in the Undo list.

Sub CreateTasksWithUndoTransaction() 
    ActiveProject.Tasks.Add "Task outside transaction" 
    Application.OpenUndoTransaction "Create 6 tasks" 
    Dim i As Integer 
    For i = 1 To 6 
        ActiveProject.Tasks.Add "UndoMe " &; i 
    Next 
    Application.CloseUndoTransaction  
End Sub
© 2018 Microsoft