OLEType Property

Applies To

Bound Object Frame Control, Chart Control, Unbound Object Frame Control.

Description

You can use the OLEType property to determine if a control contains an OLE object, and, if so, whether the object is linked or embedded.

Setting

The OLEType property uses the following settings.

Setting

Description

Visual Basic

Linked

The control contains a linked object. All the object’s data is managed by the application that created it.

0

Embedded

The control contains an embedded object. All the object’s data is managed by Microsoft Access.

1

None

The control doesn’t contain an OLE object.

3


The OLEType property is read-only in all views.

Remarks

When creating an OLE object, use the OLETypeAllowed property to determine what type of object a control can contain.

See Also

Action Property, OLETypeAllowed Property.

Example

The following example illustrates how to display the Insert Object dialog box and how to display an error message if the Cancel button in the Insert Object dialog box is clicked, so no object will be created.


Sub InsertObject_Click()
    Dim conUserCancelled As Integer
    conUserCancelled = 2001                ' Error message returned
                                        ' when user cancels.Error GoTo ButtonErr                    ' Set up error handler.
    If OLE1.OLEType = 3 Then                ' No OLE Object created.
        OLE1.Action = acOLEInsertObjDlg    ' Display Insert Object
                                        ' dialog box.
    End If
    Exit Sub:
    If Err = conUserCancelled Then    ' Display message.
    MsgBox "You pressed the Cancel button, no object was created."
    End If
    Resume NextSub