BeforeDropOrPaste event
Occurs when the user is about to drop or paste data onto an object.
Syntax
For Frame
Private Subobject _BeforeDropOrPaste( ByValCancelAs MSForms.ReturnBoolean,
ctrlAs Control,
ByValActionAs fmAction,
ByValDataAs DataObject,
ByValXAs Single,
ByValYAs Single,
ByValEffectAs MSForms.ReturnEffect,
ByValShiftAs fmShiftState)
For MultiPage
Private Subobject _BeforeDropOrPaste(indexAs Long,
ByValCancelAs MSForms.ReturnBoolean,
ctrlAs Control,
ByValActionAs fmAction,
ByValDataAs DataObject,
ByValXAs Single,
ByValYAs Single,
ByValEffectAs MSForms.ReturnEffect,
ByValShiftAs fmShiftState)
For TabStrip
Private Subobject _BeforeDropOrPaste(indexAs Long,
ByValCancelAs MSForms.ReturnBoolean,
ByValActionAs fmAction,
ByValDataAs DataObject,
ByValXAs Single,
ByValYAs Single,
ByValEffectAs MSForms.ReturnEffect,
ByValShiftAs fmShiftState)
For other controls
Private Subobject _BeforeDropOrPaste( ByValCancelAs MSForms.ReturnBoolean,
ByValActionAs fmAction,
ByValDataAs DataObject,
ByValXAs Single,
ByValYAs Single,
ByValEffectAs MSForms.ReturnEffect,
ByValShiftAs fmShiftState)
The BeforeDropOrPaste event syntax has these parts:
Part | Description |
---|---|
object | Required. A valid object name. |
index | Required. The index of the Page in a MultiPage that the drop or paste operation will affect. |
Cancel | Required. Event status. False indicates that the control should handle the event (default). True indicates the application handles the event. |
ctrl | Required. The target control. |
Action | Required. Indicates the result, based on the current keyboard settings, of the pending drag-and-drop operation. |
Data | Required. Data that is dragged in a drag-and-drop operation. The data is packaged in a DataObject. |
X, Y | Required. The horizontal and vertical position of the mouse pointer when the drop occurs. Both coordinates are measured in points. X is measured from the left edge of the control; Y is measured from the top of the control.. |
Effect | Required. Effect of the drag-and-drop operation on the target control. |
Shift | Required. Specifies the state of SHIFT, CTRL, and ALT. |
Settings
The settings for Action are:
Constant | Value | Description |
---|---|---|
fmActionPaste | 2 | Pastes the selected object into the drop target. |
fmActionDragDrop | 3 | Indicates the user has dragged the object from its source to the drop target and dropped it on the drop target. |
The settings for Effect are:
Constant | Value | Description |
---|---|---|
fmDropEffectNone | 0 | Does not copy or move the drop source to the drop target. |
fmDropEffectCopy | 1 | Copies the drop source to the drop target. |
fmDropEffectMove | 2 | Moves the drop source to the drop target. |
fmDropEffectCopyOrMove | 3 | Copies or moves the drop source to the drop target. |
The settings for Shift are:
Constant | Value | Description |
---|---|---|
fmShiftMask | 1 | SHIFT was pressed. |
fmCtrlMask | 2 | CTRL was pressed. |
fmAltMask | 4 | ALT was pressed. |
Remarks
For a MultiPage or TabStrip, Visual Basic for Applications initiates this event when it transfers a data object to the control.
For other controls, the system initiates this event immediately prior to the drop or paste operation.
When a control handles this event, you can update the Action argument to identify the drag-and-drop action to perform.
When Effect is set to fmDropEffectCopyOrMove, you can assign Action to fmDropEffectNone, fmDropEffectCopy, or fmDropEffectMove.
When Effect is set to fmDropEffectCopy or fmDropEffectMove, you can reassign Action to fmDropEffectNone. You cannot reassign Action when Effect is set to fmDropEffectNone.
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.