1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| Public Function GetMethod(ByVal strRefName As String, ByVal strObject As String, _
Optional ByVal item As String = "*") As Collection
Dim objTLI As TypeLibInfo
Dim objInterFace As InterfaceInfo
Dim objMember As MemberInfo
Dim i As Integer
Dim strTypeName As String, strLastAdded As String
Set objTLI = New TypeLibInfo
objTLI.ContainingFile = Application.References(strRefName).FullPath
For i = 1 To objTLI.TypeInfos.Count
If (objTLI.TypeInfos(i).Name = strObject) Then
Set objInterFace = objTLI.TypeInfos(i).Interfaces(1)
Exit For
End If
Next i
If Not (objInterFace Is Nothing) Then
For Each objMember In objInterFace.Members
If Not (Left$(objMember.Name, 1) = "_") And _
Not (objMember.Name = strLastFound) And _
(objMember.InvokeKind = INVOKE_FUNC Or _
objMember.InvokeKind = INVOKE_EVENTFUNC) And _
(objMember.Name Like item) Then
Debug.Print objMember.Name
strLastFound = objMember.Name
End If
Next objMember
End If
End Function |
Partager