VBA Project

By default every project is initially named VBAProject, therefore the list may contain several identically named items.
To distinguish a project change its name in the Properties window of the original project using the VB Editor.


VBAProject.References ?? 

This is a list of all the references (libraries) that are being used in this project
You can determine their name, file name and description.


If you add any additional references are these stored in a specific place in the Registry.


Dim icount As Integer 
   
For icount = 1 To Application.VBE.ActiveVBProject.References.Count
   With Application.VBE.ActiveVBProject.References(icount)
      Debug.Print "Name: " & .BuiltIn
'Debug.Print "Name: " & .Collection.Item(icount)
      Debug.Print "Name: " & .Description
      Debug.Print "Name: " & .FullPath
      Debug.Print "Name: " & .GUID
      Debug.Print "Name: " & .IsBroken
      Debug.Print "Name: " & .Major
      Debug.Print "Name: " & .Minor
      Debug.Print "Name: " & .Name
      Debug.Print "Name: " & .Type
'Debug.Print "Name: " & .VBE
   End With
Next icount

Checking External References

The VBIDE References collection provides a method of checking that all the application's references are installed.

Dim objReference As Object 
Dim bBroken As Boolean
Dim sDescription As String

For Each objReference In ThisWorkbook.VBProject.References
   If objReference.IsBroken Then
''some broken links do not have descriptions so ignore the error ?
      On Error Resume Next
      sDescription = "Not Known"
      sDescription = objReference.Description
      On Error GoTo 0

      Call Msgbox ("The following reference is missing:" & vbcrlf & _
                          "Name: " & sDescription & vbcrlf & _
                          "Path: " & objReference.FullPath & vbcrlf & _
                           "This library or file needs reinstalling.")
      bBroken = True
   End If
Next

If bBroken = True Then End


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext