ObjectVerbs Property

Applies To

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

Description

You can use the ObjectVerbs property in Visual Basic to determine the list of verbs an OLE object supports. A verb, such as edit or play, specifies an operation a user can perform on an OLE object.

Setting

The ObjectVerbs property setting is a zero-based string array.

This property setting isn’t available in Design view and is read-only in other views.

Remarks

You can use the ObjectVerbs property with the ObjectVerbsCount property to display a list of the verbs supported by an OLE object. The Verb property uses this list of verbs to determine which operation to perform when an OLE object is activated (when the Action property is set to acOLEActivate).

The Verb property setting is the position of a particular verb in the list of verbs returned by the ObjectVerbs property. For example, 1 specifies the first verb in the list (the Visual Basic command ObjectVerbs(0), or the first verb in the ObjectVerbs property array), 2 specifies the second verb in the list (the Visual Basic command ObjectVerbs(1), or the second verb in the ObjectVerbs property array), and so on.

The first verb in the ObjectVerbs property array, called by the Visual Basic command ObjectVerbs(0), is the default verb. If the Verb property hasn’t been set, this verb specifies the operation performed when the OLE object is activated.

Applications that expose OLE objects typically include the Object command on the Edit menu. When the user clicks this command, a submenu displays the object’s verbs. You can use the ObjectVerbs and ObjectVerbsCount properties to display a list of verbs in a form or report instead of on a menu.

The list of verbs an object supports varies, depending on the state of the object. To update the list of verbs an object supports, set the control’s Action property to acOLEFetchVerbs. Be sure to update the list of verbs before presenting it to the user.

See Also

Action Property, ObjectVerbsCount Property, Verb Property.

Example

The following example returns the verbs supported by the OLE object in the OLE1 control and displays each verb in a message box.


Function GetVerbList(frm As Form) As Integer
    Dim intX As Integer, intNumVerbs As Integer
    Dim strVerbListArray() As String
    frm!OLE1.Action = acOLEFetchVerbs    ' Update verb list.
    intNumVerbs = frm!OLE1.ObjectVerbsCount
    ReDim strVerbListArray(intNumVerbs)
        For intX = 0 To intNumVerbs - 1    ' For each verb.
        ' Return verb.
        strVerbListArray(intX) = frm!OLE1.ObjectVerbs(intX)
        MsgBox strVerbListArray(intX)    ' Display verb in message box.
    Next intXFunction