Excel Macro to get Reference VBA Project from an Excel file

  • Hi,
    Is there any macro to pull information about what References VBA Project are tick on for our active sheet or workbook?
    By running the macro I can get a list of what References VBA Project was on.


  • administrators

    Why don't you just go to Tools > references

  • Hi,
    Yes I do use your way so far,
    I just try to find some other way to get a full list of what is on.
    I got from another forum, this code written by John Walkenbach:

    Option Explicit
    Sub ListSelectedReferences()
        'Needs the 'Trust access to the VBA project object model' macro security option to be ticked.
        Dim varVBReference As Variant
        Dim intRefCount    As Integer
        Dim strDetails     As String
        With ThisWorkbook
            For Each varVBReference In .VBProject.References
                intRefCount = intRefCount + 1
                strDetails = strDetails & intRefCount & ". " & varVBReference.Name & vbNewLine
                strDetails = strDetails & varVBReference.Description & vbNewLine
                strDetails = strDetails & varVBReference.FullPath & vbNewLine
            Next varVBReference
            MsgBox strDetails
        End With
    End Sub

  • administrators

    Thanks for sharing!

  • your welcome.

Log in to reply

Looks like your connection to Codingislove Forum was lost, please wait while we try to reconnect.