PasteOK Property

See Also19TKCIZ              Example5OIT8LW>Low

Applies To

OLE control2HQDVVU.


Specifies whether the contents of the Clipboard can be pasted into the OLE control.  Not available at design time; read-only at run time.




When this property returns True, the contents of the Clipboard can be pasted into the OLE control.

Use the OleTypeAllowed property to specify the type of object (linked or embedded) that can be pasted into the OLE control.  Once an object has been successfully pasted into the OLE control, you can query the OleType property to determine the type of object that was created.

This property can be useful if your application supports the Paste command in the Edit menu.  If PasteOK is False, then the Edit Paste command should be disabled; otherwise it can be enabled.  Enable and disable menu commands by setting their Enabled property to True and False, respectively.

You paste an object into the OLE control by setting Action = 5 (Paste).

To provide more flexibility to the user, display a Paste Special dialog when the user selects the Edit Paste command (set OleTypeAllowed = 2, and Action = 15).  When this dialog is displayed, an object is pasted to the Clipboard based on the user's selections in the dialog.

Data Type

IntegerDOKXHY (Boolean)

See Also


Action Property04T78S3

Enabled Property3XD4FN

OleType Property12K24M2

OleTypeAllowed Property633XBW1


Programmer's Guide:

Chapter 22, "Object Linking and Embedding (OLE)"

PasteOK Property Example

The example code cannot run by itself, but it illustrates how to paste the contents of the Clipboard into the OLE control when the user chooses the appropriate menu item.  To see how this works in an application, load the sample program OLE2DEMO.MAK, and place a breakpoint in the mnuEditClick procedure.  Then press F5 and choose Paste from the Edit menu.

Sub mnuEditPaste_Click ()
   ' Check value of PasteOK.
   If Ole1.PasteOK Then
      Ole1.Action = 5                ' Do the Paste if OK.
   Else                              ' Otherwise disable Paste
      mnuEditPaste.Enabled = False   ' menu item and give
   MsgBox "Cannot Paste"             ' appropriate message.
   End If
End Sub