BeforeDropOrPaste Event

Occurs when the user is about to drop or paste data onto an object.

Syntax

For Frame
Private Sub object_BeforeDropOrPaste( ByVal Cancel As MSForms.ReturnBoolean, ctrl As Control, ByVal Action As fmAction, ByVal Data As DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As fmShiftState)

For MultiPage
Private Sub object_BeforeDropOrPaste( index As Long, ByVal Cancel As MSForms.ReturnBoolean, ctrl As Control, ByVal Action As fmAction, ByVal Data As DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As fmShiftState)

For TabStrip
Private Sub object_BeforeDropOrPaste( index As Long, ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As fmAction, ByVal Data As DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As fmShiftState)

For other controls
Private Sub object_BeforeDropOrPaste( ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As fmAction, ByVal Data As DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As fmShiftState)

The BeforeDropOrPaste event syntax has these parts:

PartDescription
objectRequired. A valid object name.
indexRequired. The index of the Page in a MultiPage that the drop or paste operation will affect.
CancelRequired. Event status. False indicates that the control should handle the event (default). True indicates the application handles the event.
ctrlRequired. The target control.
ActionRequired. Indicates the result, based on the current keyboard settings, of the pending drag-and-drop operation.
DataRequired. Data that is dragged in a drag-and-drop operation. The data is packaged in a DataObject.
X, YRequired. 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..
EffectRequired. Effect of the drag-and-drop operation on the target control.
ShiftRequired. Specifies the state of SHIFT, CTRL, and ALT.

Settings

The settings for Action are:

ConstantValueDescription
fmActionPaste2Pastes the selected object into the drop target.
fmActionDragDrop3Indicates 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:

ConstantValueDescription
fmDropEffectNone0Does not copy or move the drop source to the drop target.
fmDropEffectCopy1Copies the drop source to the drop target.
fmDropEffectMove2Moves the drop source to the drop target.
fmDropEffectCopyOrMove3Copies or moves the drop source to the drop target.

The settings for Shift are:

ConstantValueDescription
fmShiftMask1SHIFT was pressed.
fmCtrlMask2CTRL was pressed.
fmAltMask4ALT 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.



Show: