Occurs when the formula or sheet being moved or copied contains a defined name which already exists on the destination worksheet or workbook.
The DefinedNameConflictResolving event's data class is DefinedNameConflictResolvingEventArgs. The following properties provide information specific to this event:
|Cancel||Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.|
|NameStatus||Gets the status of the conflict name.|
|NewName||Gets or sets the name for a new version of the defined name being moved or copied.|
|OldName||Gets the defined name for which the event is fired.|
|UsedNames||Provides access to the set of table and defined names existing in the destination workbook.|
|UseExistingName||Gets or sets a value indicating whether to use the defined name specified on the destination worksheet or workbook in the conflict situation.|
|Validator||Gets or sets a validator used to check whether a new version of the conflict name is valid and unique.|
Note that when you’re working with a Workbook, you don’t need to subscribe to the DefinedNameConflictResolving event, since a valid version of the copied name is automatically generated and used by default in the conflict situation. To change this name, handle the DefinedNameConflictResolving event and assign the necessary name to the DefinedNameConflictResolvingEventArgs.NewName parameter.
To use the defined name specified on the destination worksheet or workbook if the conflict occurs during the copy operation, set the DefinedNameConflictResolvingEventArgs.UseExistingName parameter to true.
The DefinedNameConflictResolvingEventArgs.Validator parameter provides access to the default validator that enables you to validate a new version of the conflict name before pasting it into the destination worksheet/workbook. You can also specify a custom validator by creating an object implementing the IDefinedNameValidator interface and assigning it to the DefinedNameConflictResolvingEventArgs.Validator property.