http://msdn.microsoft.com/en-us/library/aa163682(v=office.10) See also http://msdn.microsoft.com/en-us/library/aa155474(v=office.10) Example http://msdn.microsoft.com/en-us/library/aa164022(v=office.10) Applies to
Ends or cancels a transaction with a unique scope.
Required. An expression that returns an Application object.
Required Long. The ID of the scope to close.
Required Boolean. A flag indicating that the changes made during the scope should be accepted (True) or canceled (False).
If you need to know whether events you receive are the result of a particular operation that you initiated, use the BeginUndoScope and EndUndoScope methods to wrap your operation. In your event handlers, use the IsInScope property to test whether the scope ID returned by the BeginUndoScope method is part of the current context. Make sure you clear the scope ID you stored from the BeginUndoScope property when you receive the ExitScope event with that ID.
You must balance calls to the BeginUndoScope method with calls to the EndUndoScope method. If you call the BeginUndoScope method, you should call the EndUndoScope method as soon as you are done with the actions that constitute your scope. Also, while actions to multiple documents should be robust within a single scope, closing a document may have the side effect of purging the undo information for the currently open scope as well as purging the undo and redo stacks. If that happens, passing bCommit = False to EndUndoScope does not restore the undo information.
You can also use the BeginUndoScope and EndUndoScope methods to add an action defined by an add-on to the Visio undo stream. This is useful when you are operating from modeless scenarios where the initiating agent is part of an add-on's user interface or a modeless programmatic action.
Note Most Visio actions are already wrapped in internal undo scopes, so add-ons running within the application do not need to call this method.