全部显示

ObjectVerbsCount 属性

       

使用 Visual Basic 中的 ObjectVerbsCount 属性可以确定 OLE 对象所支持的动词数目。Long 型,可读写。

expression.ObjectVerbsCount

expression   必需。返回“Applies To”列表中的一个对象的表达式。

说明

ObjectVerbsCount 属性设置用于指定 ObjectVerbs 属性数组中的元素数目。

该属性设置在“设计”视图中不可用。

根据对象状态的不同,OLE 对象支持的动词列表是变化的。如果要更新所支持的动词列表,请将控件Action 属性设为 acOLEFetchVerbs

示例

下面的示例将返回 OLE1 控件中的 OLE 对象所支持的动词,并在消息框中显示每个动词。

Sub GetVerbList(frm As Form, OLE1 As Control)
    Dim intX As Integer, intNumVerbs As Integer
    Dim strVerbList As String

    ' Update verb list.
    With frm!OLE1
        .Action = acOLEFetchVerbs
        intNumVerbs = .ObjectVerbsCount
        For intX = 0 To intNumVerbs - 1
            strVerbList = strVerbList & .ObjectVerbs(intX) & "; "
        Next intX
    End With

    ' Display verbs in message box.
    MsgBox Left(strVerbList, Len(strVerbList) - 2)
End Sub