Bound Object Frame Control, Chart Control, Unbound Object Frame Control.
You can use the Action property in Visual Basic to specify the operation to perform on an OLE object.
The Action property uses the following settings.
Constant | Value | Description |
acOLECreateEmbed | 0 | Creates an embedded object. To use this setting, you must first set the controls OLETypeAllowed property to acOLEEmbedded or acOLEEither. Set the Class property to the type of OLE object you want to create. You can use the SourceDoc property to use an existing file as a template. |
acOLECreateLink | 1 | Creates a linked OLE object from the contents of a file. To use this setting, you must first set the controls OLETypeAllowed and SourceDoc properties. Set the OLETypeAllowed property to acOLELinked or acOLEEither. The SourceDoc property specifies the file used to create the OLE object. You can also set the controls SourceItem property (for example, to specify a row-and-column range if the object youre creating is a Microsoft Excel worksheet). When you create an OLE object using this setting, the control displays a metafile graphic image of the file specified by the controls SourceDoc property. If you save the OLE object, only the link information, such as the name of the application that supplied the object and the name of the linked file, is saved because the control contains an image of the data but no source data. |
acOLECopy | 4 | Copies the object to the Clipboard. When you copy an OLE object to the Clipboard, all the data and link information associated with the object is placed on the Clipboard as well. You can copy both linked and embedded objects onto the Clipboard. Using this setting is equivalent to clicking Copy on the Edit menu. |
acOLEPaste | 5 | Pastes data from the Clipboard to the control. If the paste operation is successful, the controls OLEType property is set to acOLELinked or acOLEEmbedded. If the paste operation isnt successful, the OLEType property is set to acOLENone. Using this setting is equivalent to clicking Paste on the Edit menu. |
acOLEUpdate | 6 | Retrieves the current data from the application that supplied the object and displays that data as a metafile graphic in the control. |
acOLEActivate | 7 | Opens an OLE object for an operation, such as editing. To use this setting, you must first set the controls Verb property. The Verb property specifies the operation to perform when the OLE object is activated. |
acOLEClose | 9 | Closes an OLE object and ends the connection with the application that supplied the object. This setting applies to embedded objects only. Using this setting is equivalent to clicking Close on the objects Control menu. |
acOLEDelete | 10 | Deletes the specified OLE object and frees the associated memory. This setting enables you 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. You cant use the Action property to delete a bound OLE object from its underlying table or query. |
acOLEInsertObjDlg | 14 | Displays the Insert Object dialog box. In Form view or Datasheet view, you display this dialog box to enable the user to create a new object or to link or embed an existing object. You can use the controls OLETypeAllowed property to determine the type of object the user can create (with the constant acOLELinked, acOLEEmbedded, or acOLEEither) using this dialog box. |
acOLEPasteSpecialDlg | 15 | Displays the Paste Special dialog box. In Form View or Datasheet view, you display this dialog box to enable the user to paste an object from the Clipboard. The dialog box provides several options, including pasting either a linked or embedded object. You can use the controls OLETypeAllowed property to determine the type of object that can be pasted (with the constant acOLELinked, acOLEEmbedded, or acOLEEither) using this dialog box. |
acOLEFetchVerbs | 17 | Updates the list of verbs an OLE object supports. To display the list of verbs, use the ObjectVerbs and ObjectVerbsCount properties. |
You can set the Action property only using Visual Basic. The Action property setting has an Integer data type value.
The Action property isnt available in Design view but can be read or set in other views.
When a control is disabled or locked, you can use some Action property settings. The following table indicates which settings are allowed or not allowed under these conditions.
Setting | Disabled | Locked |
acOLECreateEmbed | Not allowed | Not allowed |
acOLECreateLink | Not allowed | Not allowed |
acOLECopy | Allowed | Allowed |
acOLEPaste | Not allowed | Not allowed |
acOLEUpdate | Not allowed | Not allowed |
acOLEActivate | Allowed | Allowed |
acOLEClose | Not allowed | Allowed |
acOLEDelete | Not allowed | Not allowed |
acOLEInsertObjDlg | Not allowed | Not allowed |
acOLEPasteSpecialDlg | Not allowed | Not allowed |
acOLEFetchVerbs | Not allowed | Allowed |
AutoActivate Property; Class Property; Enabled, Locked Properties; ObjectVerbs Property; ObjectVerbsCount Property; OLEType Property; OLETypeAllowed Property; SourceDoc Property; SourceItem Property; UpdateOptions Property; Verb Property.
The following example creates a linked OLE object and sizes the control to display the objects entire contents when the user clicks a command button.
Sub Command1_Click OLE1.Class = "Excel.Sheet" ' Set class name. OLE1.OLETypeAllowed = acOLELinked ' Specify type of object. OLE1.SourceDoc = "C:\Excel\Oletext.xls" ' Specify source file. OLE1.SourceItem = "R1C1:R5C5" ' Specify data to link. OLE1.Action = acOLECreateLink ' Create linked object. OLE1.SizeMode = acOLESizeZoom ' Adjust control size.Sub