VBA Excel – Retrouver la liste des références activées pour le projet

Source

Sub lista_Referencji()

Dim ref, msg$

    msg = ""

    For Each ref In ActiveWorkbook.VBProject.References
        msg = msg & ref.Name & vbCr
        msg = msg & ref.Description & vbCr
        msg = msg & ref.FullPath & vbCr & vbCr
    Next ref

    MsgBox msg, , " Reference for: " & ActiveWorkbook.Name

    Debug.Print msg

End Sub

Public Sub ProjectReferencesList()

Dim i                   As Long
Dim VBProj              As Object  'VBIDE.VBProject
Dim VBComp              As Object 'VBIDE.VBComponent
Dim strTmp              As String

    Set VBProj = Application.VBE.ActiveVBProject
    On Error Resume Next

    For i = 1 To VBProj.References.Count

        With VBProj.References.Item(i)
            Debug.Print "Description: " & .Description & vbNewLine & _
            "FullPath: " & .FullPath & vbNewLine & _
            "Major/Minor: " & .Major & "." & .Minor & vbNewLine & .Name    '; .Type
            strTmp = ""
            strTmp = .FullPath
            Debug.Print "-------------------"
        End With

    Next

End Sub

Sub List_Available_References()

Dim i As Long

    Debug.Print "Reference", "GUID", , , "Path"

    For i = 1 To ThisWorkbook.VBProject.References.Count
        With ThisWorkbook.VBProject.References(i)
            Debug.Print .Name, .GUID, .FullPath
        End With
    Next i
End Sub

Cela va donner un output comme, p.ex.,

Description: Visual Basic For Applications
FullPath: C:\PROGRA~2\COMMON~1\MICROS~1\VBA\VBA7.1\VBE7.DLL
Major/Minor: 4.2
VBA
-------------------
Description: Microsoft Excel 15.0 Object Library
FullPath: C:\Program Files (x86)\Microsoft Office\Office15\EXCEL.EXE
Major/Minor: 1.8
Excel
-------------------
Description: OLE Automation
FullPath: C:\Windows\SysWOW64\stdole2.tlb
Major/Minor: 2.0
stdole
-------------------
Description: Microsoft Office 15.0 Object Library
FullPath: C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\MSO.DLL
Major/Minor: 2.7
Office
-------------------
Description: Microsoft Visual Basic for Applications Extensibility 5.3
FullPath: C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB
Major/Minor: 5.3
VBIDE
-------------------
Description: Microsoft ActiveX Data Objects 2.8 Library
FullPath: C:\Program Files (x86)\Common Files\System\ado\msado28.tlb
Major/Minor: 2.8
ADODB
-------------------
Description: Microsoft Forms 2.0 Object Library
FullPath: C:\Windows\SysWOW64\FM20.DLL
Major/Minor: 2.0
MSForms
-------------------
Description: Microsoft Scripting Runtime
FullPath: C:\Windows\SysWOW64\scrrun.dll
Major/Minor: 1.0
Scripting
-------------------