Document Copy/Move Events

Some events occur when documents are moved or created as copied, derived, or replacement documents.

Events which have an asterisk (*) in their name in the expanding sections below also have precursor events which occur prior to the main event. For example, the PreBeforeCopy event occurs before the BeforeCopy event. Both the precursor event and its subsequent event are described in the same expanding section.

ClosedDocument Copy/Move Event Sequences

The events that occur for the document copy and move commands are shown in the following lists in the sequence that they occur.

ClosedCopy, Paste, Derive, Replace event sequence

  1. DocCopyMoveEvent_SelectTarget

  2. DocCopyMoveEvent_PrepareCopy: Source document only.

  3. DocCopyMoveEvent_PreInitializeCopy

  4. DocCopyMoveEvent_InitializeCopy: Copy and Paste commands only.

  5. DocCopyMoveEvent_InitializeDerive: Derive command only.

  6. DocCopyMoveEvent_InitializeReplace: Replace command only.

  7. DocGenericEvent_InitializeNewDocument

  8. DocGenericEvent_InitializeCalculateFileName

  9. DocCopyMoveEvent_PreBeforeCopyWithReferences

  10. DocCopyMoveEvent_BeforeCopyWithReferences: Copy with References command and Derive with References commands only.

  11. DocCopyMoveEvent_PreBeforeCopy: PreBeforeCopy is not called when executing Copy with References. Copy with References will call PreBeforeCopyWithReferences.

  12. DocCopyMoveEvent_BeforeCopy: Copy and Paste commands only.

  13. DocCopyMoveEvent_AfterCopy: Copy and Paste commands only.

  14. DocCopyMoveEvent_BeforeDerive: Derive command only.

  15. DocCopyMoveEvent_AfterDerive: Derive command only.

  16. DocCopyMoveEvent_BeforeReplace: Replace command only.

  17. DocCopyMoveEvent_AfterReplace: Replace command only.

  18. DocGenericEvent_BeforeNewDocument

  19. DocGenericEvent_OnProperties: Except Paste command.

  20. DocGenericEvent_AfterNewDocument

  21. DocCopyMoveEvent_AfterCopyWithReferences: Copy with References command and Derive with References commands only.

  22. DocGenericEvent_TerminateCalculateFileName

  23. DocGenericEvent_TerminateNewDocument

  24. DocCopyMoveEvent_TerminateCopy: Copy and Paste commands only.

  25. DocCopyMoveEvent_TerminateDerive: Derive command only.

  26. DocCopyMoveEvent_TerminateReplace: Replace command only.

ClosedMove event sequence

  1. DocCopyMoveEvent_InitializeMove

  2. DocGenericEvent_InitializeNewDocument

  3. DocGenericEvent_InitializeCalculateFileName

  4. DocCopyMoveEvent_BeforeMove

  5. DocCopyMoveEvent_AfterMove

  6. DocGenericEvent_BeforeNewDocument

  7. DocGenericEvent_OnProperties

  8. DocGenericEvent_AfterNewDocument

  9. DocGenericEvent_TerminateCalculateFileName

  10. DocGenericEvent_TerminateNewDocument

  11. DocCopyMoveEvent_TerminateMove

ClosedAfterCopy Event

Occurs after documents are copied and pasted. Applies to Copy and Paste commands only.

Syntax

DocCopyMoveEvent_AfterCopy(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

ClosedAfterCopyWithReferences Event

Occurs after documents are copied with references. Applies to Copy with References command and Derive with References commands only.

Syntax

DocCopyMoveEvent_AfterCopyWithReferences(Batch, SourceDocument, OldParentDocument, NewParentDocument)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

SourceDocument

An object that represents the source document.

OldParentDocument

An object that represents the parent document of the source documents.

NewParentDocument

An object that represents the parent document of the copied documents.

ClosedAfterDerive Event

Occurs after documents are derived. Applies to Derive command only.

Syntax

DocCopyMoveEvent_AfterDerive(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

ClosedAfterMove Event

Occurs after documents are moved.

Syntax

DocCopyMoveEvent_AfterMove(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

ClosedAfterReplace Event

Occurs after documents are replaced.

Syntax

DocCopyMoveEvent_AfterReplace(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

Closed*BeforeCopy Event

Occurs before documents are copied. The PreBeforeCopy event can be used to add a confirmation page before the BeforeCopy event. This event can be used as part of a wizard.

PreBeforeCopy is not called when executing the Copy with References command. Copy with References will call PreBeforeCopyWithReferences.

Syntax

DocCopyMoveEvent_*BeforeCopy(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

Remarks

Learn how to create confirmation pages. You can also see examples of this functionality in this Knowledgebase article.

Closed*BeforeCopyWithReferences Event

Occurs before documents are copied with references. Applies to Copy with References command and Derive with References commands only.

The PreBeforeCopyWithReferences event occurs before the BeforeCopyWithReferences event. PreBeforeCopyWithReferences can be used to add a confirmation page before the Copy with References Wizard.

Syntax

DocCopyMoveEvent_*BeforeCopyWithReferences(Batch, OldParentDocument, NewParentDocument, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

OldParentDocument

An object that represents the parent document of the source documents.

NewParentDocument

An object that represents the parent document of the copied documents.

TargetFolder

An object that represents the destination folder. This event can modify the destination folder.

Remarks

When a project copy is made of an assembly, this event occurs for all documents in the assembly, even those that are not copied but stay referenced. This can occur if the Default Duplicator Action option of the document type is set to Reference the source instead of Reference the copies (which were made by the command). You can confirm which documents were actually copied by checking the value of the TargetFolder parameter, which will be empty for the documents that were not copied.

Learn how to create confirmation pages. You can also see examples of this functionality in this Knowledgebase article.

Closed*InitializeCopy Event

Occurs when documents are copied. Applies to Copy and Paste commands only.

The PreInitializeCopy event can be used to add a confirmation page before the InitializeCopy event. PreInitializeCopy can also be used as part of a wizard.

Syntax

DocCopyMoveEvent_*InitializeCopy(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

Remarks

Learn how to create confirmation pages. You can also see examples of this functionality in this Knowledgebase article.

ClosedInitializeDerive Event

Occurs when documents are derived. Applies to Derive command only.

Syntax

DocCopyMoveEvent_InitializeDerive(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

ClosedInitializeMove Event

Occurs when documents are moved.

Syntax

DocCopyMoveEvent_InitializeMove(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

ClosedInitializeReplace Event

Occurs when documents are replaced. Applies to Replace command only.

Syntax

DocCopyMoveEvent_InitializeReplace(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

ClosedPrepareCopy Event

Occurs before a batch of documents are copied by various Meridian commands, but unlike other initialization events, it occurs for the current document in the batch.

Syntax

DocCopyMoveEvent_PrepareCopy (Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder. This event can modify the destination folder.

Example

The following example demonstrates how to assign a project copy to a known project folder (retrieved from a document property, for example) and how to suppress the Select Folder and Reference Explorer (for reference selection if references exist) dialog boxes.

Sub DocCopyMoveEvent_PrepareCopy(Batch, TargetFolder)
  If Not Document Is Nothing Then
    If Client.ImportType = AS_IT_COPIED And Client.ImportDetails = AS_ID_CREATEPROJCOPY Then
      'Add your code for document objects
      TargetFolder = "\Design\Projects\894" 'Or some property value
      'Suppress folder selection dialog
      Client.Confirmation(AS_CONFIRM_PROJECT_FOLDER) = False
      'Suppress reference selection dialog
      Client.Confirmation(AS_CONFIRM_SELECT_ASSEMBLY_ITEMS) = False
    End If
  ElseIf Not Folder Is Nothing Then
    'Add your code for folder objects
  End If
End Sub

ClosedSelectTarget Event

Occurs when a document is copied by the Import Documents, Copy (simple), Derive, and Replace commands. This event can be used to show the user a dialog box for folder, projects, or no dialog box.

Syntax

DocCopyMoveEvent_SelectTarget (Batch, TargetFolder, DialogToShow)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

This event occurs once for each document in the batch.

TargetFolder

An object that represents the default destination folder. This event can set the destination folder.

DialogToShow

The type of dialog box to show for folder selection, one of the AS_SELECT_DIALOG_TYPE constants.

Remarks

The Document object in this event is the source document. This event is equivalent to the AS_CONFIRM_NO_SELECTPROJECTWIZARD constant. For the corresponding event for newly created documents, see DocGenericEvent_SelectTarget event.

ClosedTerminateCopy Event

Occurs when a copy event is terminated. Applies only to Copy and Paste commands.

Syntax

DocCopyMoveEvent_TerminateCopy(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

ClosedTerminateDerive Event

Occurs when document derive event is terminated. Applies to Derive command only.

Syntax

DocCopyMoveEvent_TerminateDerive(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

ClosedTerminateMove Event

Occurs when document move event is terminated.

Syntax

DocCopyMoveEvent_TerminateMove(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

ClosedTerminateReplace Event

Occurs when document replace event is terminated. Applies to Replace command only.

Syntax

DocCopyMoveEvent_TerminateReplace(Batch, TargetFolder)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

TargetFolder

An object that represents the destination folder.

2024