Access.References Name or Description

GohDiamond

"Access- Imagineer that!"
Local time
Yesterday, 20:47
Joined
Nov 1, 2006
Messages
550
Is there a way to get the Full Name of Access.References programmatically?

I can get the short name using:

Function CheckReferences()
Dim ref As Reference
Dim refName As String

For Each ref In Access.References
Debug.Print ref.Name & " " & ref.FullPath & " " & ref.Major & "." & ref.Minor
Next ref
End Function​
But the Result is like:
VBA
Access
DAO​
What we commonly see in the Tools\References Dialog Box is like:
Visual Basic for Applications
Microsoft Access 12.0 Object Library
Microsoft Office 12.0 Access database engine Object Library​

I'd like to return the common name as we see it in the Dialog Box.
Is it in the ref.collection(???) maybe? If so, how do I address that information?

Thanks for any help,
Goh
 
I ran a search and found this code you could use as a starting point. I ran it and the Description is what you want.

Code:
Public Sub ProjectReferencesList()
    Dim i                   As Long
    Dim VBProj              As Object  'VBIDE.VBProject
    Dim VBComp              As Object 'VBIDE.VBComponent
    Set VBProj = Application.VBE.ActiveVBProject
    Dim strTmp              As String
    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
 
PERFECT for me. Here's my solution with a little formatting

Function chkrefs()

Dim ref As Reference
Dim refName As String
Dim nCount As Integer
Debug.Print "|---- Available References (Selected) ----|"
For Each ref In Access.References
nCount = nCount + 1

Debug.Print " " & nCount & ": " & _
Application.VBE.ActiveVBProject.References.Item(nCount).Description & _
vbNewLine & vbNewLine & _
" Location: (" & ref.FullPath & ") " & vbNewLine & _
" --------------------------------------"​
Next ref​
Debug.Print "|---- Available References (END) ---------|"​
End Function​

Note: in the post there may appear to be a visiual glitch in Item(nCount) showing a space between "nC" and "ount", but it was posted correctly with no space in that variable name.

Results shoud resemble:

|---- Available References (Selected) ----|
1: Visual Basic For Applications

Location: (C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6.DLL)
--------------------------------------

etc., etc....

Thanks for your assistance!

Cheers,
Goh
 

Users who are viewing this thread

Back
Top Bottom