Action Property (OLE)

See Also1A7LNAP

Applies To

OLE control2HQDVVU.

Description

Determines an action to take.  Not available at design time; write-only at run time.

Usage

[form.]ole.Action = setting

Setting

By setting the Action property at run time, you can perform the following operations:

Setting         Description

 

0                   OLE_CREATE_EMBEDcreates an embedded object.

                     To use this action, you must first set the Class and OleTypeAllowed properties.  Set the OleTypeAllowed property to 1 (Embedded) or 2 (Either).  The Class property determines the type of OLE object to create.  To view a list of valid class names on your system, select the Class property in the Properties window and click the three dots (...) in the Settings box.

                     When you create a new OLE object, the executable file associated with the class name (for example, EXCEL.EXE) must either be active or on the system's path.

1                   OLE_CREATE_LINKcreates a linked OLE object from the contents of a file.

                     To use this action, you must first set the OleTypeAllowed and SourceDoc properties.  Set OleTypeAllowed to 0 (Linked) or 2 (Either).  The SourceDoc property specifies the file from which the OLE object is created.  You can also set the SourceItem property (for example, a row/column range specification if the application creating the object is a Microsoft Excel worksheet).

                     When an OLE object is created with this action, the OLE control simply displays an image of the file specified by the SourceDoc property.  If the OLE object is saved, only the link references are saved, since the OLE control contains only a metafile image of the data and no source data.

                     When creating a new OLE object, the executable file associated with the class name (for example, EXCEL.EXE) must either be active or on the system's path.

2                   Reserved for future use.

3                   Reserved for future use.

4                   OLE_COPYcopies the object to the Clipboard.

                     When an OLE object is copied to the Clipboard, all the data and link information associated with the object is placed on the Clipboard.  You can copy both linked and embedded objects to the Clipboard.

                     You can use this action to support an Edit Copy command.

5                   OLE_PASTEcopies data from the Clipboard to an OLE control.

                     To use this action, set the OleTypeAllowed property, and then check the value of the PasteOK property.  You cannot paste successfully unless PasteOK returns a value of True.

                     If the Paste was successful, the OleType property will be set to 0 (Link) or 1 (Embed).  If the Paste was not successful, the OleType property will be set to 3 (None).

                     You can use this action to support an Edit Paste command.

                     See the PasteOKMF6ISM property topic for more information and an example.

6                   OLE_UPDATEretrieves the current data from the application that supplied the object and displays that data as a picture in the OLE control.

7                   OLE_ACTIVATEopens an OLE object for an operation, such as editing.

                     To use this action, first set the Verb property.  The Verb property specifies the operation to perform when the OLE object is activated.

                     If you set the AutoActivate property to 2 (Double-Click), the OLE control will automatically activate the current object when the user double-clicks the control.

8                   Reserved for future use.

9                   OLE_CLOSEcloses an OLE object and terminates the connection with the application that provided the object.  This action applies to embedded objects only.  It has no effect on linked objects.

                     This action is equivalent to the user choosing Close from the object's Control-menu box.

10                  OLE_DELETEdeletes the specified OLE object and frees the memory associated with it.

                     This action allows the programmer to explicitly delete an OLE object.  Objects are automatically deleted when a form is closed or when the object is updated to a new object.

11                  OLE_SAVE_TO_FILEsaves an OLE object to a data file.

                     To use this action, first set the FileNumber property.  The FileNumber property must correspond to an open, binary file.

                     If the OLE object is linked (OleType = 0, Linked), then only the link information and an image of the data is saved to the specified file.  The object's data is maintained by the application that created the object.  If the OLE object is embedded (OleType = 1, Embedded), the object's data is maintained by the OLE control and can be saved by your Visual Basic application.

                     See the FileNumber349SJPB property topic for an example.

12                  OLE_READ_FROM_FILEloads an OLE object from a data file created using the SaveToFile action.

                     To use this action, first set the FileNumber property.  The FileNumber property must correspond to an open, binary file.

                     See the FileNumber349SJPB property topic for an example.

13                  Reserved for future use.

14                  OLE_INSERT_OBJ_DLGdisplays the Insert Object dialog.  At run time, you display this dialog to allow the user to create a linked or embedded object.  Using this dialog, the user chooses the type of object (linked or embedded) and the application that is to provide the object.

                     Use the OleTypeAllowed property to determine the type of object that can be created (linked, embedded, either) using this dialog.

15                  OLE_PASTE_SPECIAL_DLGdisplays the Paste Special dialog.  At run time, you display this dialog to allow the user to paste an object from the Clipboard.  This dialog displays several options to the user, including pasting either a linked or embedded object.

                     Use the OleTypeAllowed property to determine the type of object that can be created (linked, embedded, either) using this dialog.

16                  Reserved for future use.

17                  OLE_FETCH_VERBSupdates the list of verbs an object supports.

18                  OLE_SAVE_TO_OLE1FILESaves an object to the OLE1 file format.

 

 

Note   Constants for Action property settings are defined in the Visual Basic file CONSTANT.TXT.

 

Data Type

IntegerDOKXHY (Enumerated)


See Also

Help:

AppIsRunning Property8UE005T

AutoActivate Property1OHYKEP

Class PropertyVN4BZO

FileNumber Property349SJPB

OleType Property12K24M2

OleTypeAllowed Property633XBW1

PasteOK PropertyMF6ISM

SourceDoc Property4200A12

SourceItem PropertyZ9ATER

UpdateOptions PropertyUKX64L

Verb Property2W0JYV2

 

Programmer's Guide:

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