Table of contents
TOC
Collapse the table of content
Expand the table of content

BeforeDropOrPaste Event

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Occurs when the user is about to drop or paste data onto an object. Syntax For Frame Private SubobjectBeforeDropOrPaste( ByVal_CancelAs MSForms.ReturnBoolean, ctrlAs Control, ByValActionAs fmAction, ByValDataAs DataObject, ByValXAs Single, ByValYAs Single, ByValEffectAs MSForms.ReturnEffect, ByValShiftAs fmShiftState) For MultiPage Private SubobjectBeforeDropOrPaste(_indexAs Long, ByValCancelAs MSForms.ReturnBoolean, ctrlAs Control, ByValActionAs fmAction, ByValDataAs DataObject, ByValXAs Single, ByValYAs Single, ByValEffectAs MSForms.ReturnEffect, ByValShiftAs fmShiftState) For TabStrip Private SubobjectBeforeDropOrPaste(_indexAs Long, ByValCancelAs MSForms.ReturnBoolean, ByValActionAs fmAction, ByValDataAs DataObject, ByValXAs Single, ByValYAs Single, ByValEffectAs MSForms.ReturnEffect, ByValShiftAs fmShiftState) For other controls Private SubobjectBeforeDropOrPaste( ByVal_CancelAs MSForms.ReturnBoolean, ByValActionAs fmAction, ByValDataAs DataObject, ByValXAs Single, ByValYAs Single, ByValEffectAs MSForms.ReturnEffect, ByValShiftAs 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.

© 2018 Microsoft