Below is code to dump references to the immediate window. I realise that
this doesn't solve your problem but maybe it's a wavering pointer :)
I also include a function to check for specific references in one of my
applications.
I recognize it prob won't fit for you but maybe you can tweak it.
The definitive routines as far as I'm concerned are from
There are references to subs that you obviously won't have the major one
being subShowMsg.
Apologies but I've just lifted this from my own code to try and give an
idea.
I make no apololies for untidy code. I'm working on a routine for that :)
If you need more or want the rest of the code just holla!!
Sub subDumpRefs()
' Dump a list of references to the immediate window.
Dim olRef As Object
Dim ilRefCount As Integer
Dim ilRef As Integer
Dim slName As String
Dim slFullPath As String
Dim slBuiltIn As String
Dim slGUID As String
Dim slIsBroken As String
Dim slVersion As String
Dim dlKind As String
Dim slDescription As String
ilRefCount = Application.VBE.ActiveVBProject.References.count
ilRef = 0
For Each olRef In Application.VBE.ActiveVBProject.References
ilRef = ilRef + 1
slDescription = olRef.Description
slName = olRef.Name
slGUID = olRef.GUID
slVersion = olRef.Major & "." & olRef.Minor
If olRef.isbroken Then
slIsBroken = "TRUE"
slFullPath = ""
Else
slIsBroken = "FALSE"
slFullPath = olRef.FullPath
End If
If olRef.BuiltIn Then
slBuiltIn = "TRUE"
Else
slBuiltIn = "FALSE"
End If
Debug.Print "Reference " & ilRef & "/" & ilRefCount _
& vbCrLf & " Name:" & slName _
& vbCrLf & "Description:" & slDescription _
& vbCrLf & " Full Path:" & slFullPath _
& vbCrLf & " Version:" & slVersion _
& vbCrLf & " GUID:" & slGUID _
& vbCrLf & " Built In:" & slBuiltIn _
& vbCrLf & " Broken:" & slIsBroken _
& vbCrLf
Next olRef
End Sub
---------------------------------------------------------------------------' If references are missing we have to stop.
slRefError = fncCheckReferences()
If slRefError <> "" Then
subShowMsg sgMsg(133) & slRefError, cgMSgBox
bgOptAbort = True
Exit Sub
End If
---------------------------------------------------------------------------Function fncCheckReferences() _
As String
sgProcName = "fncCheckReferences"
' Return "" if all references are OK.
' Return the bad reference name if not.
' These items MUST be referenced.
' 1 The VBIDE.... Name = VBIDE
' In order to reference the references.
' 2 The template.... Name = TemplateProject
' For the styles/autotexts.
' 3 Scripting runtime.... Name = Scripting
' For File/Folder actions.. exists/create etc.
' Note that this is all hard coded.
' Only the NAMES are checked at the moment until
' we know if more is nessesary.
' Properties to check could be Name, GUID, Description.
' One of these sometimes has MISSING in
' it which is also a problem.
Dim olRText As AutoTextEntry
Dim olRef As Reference
Dim olReferences As References
Dim ilRefCount As Integer
Dim ilRef As Integer
Dim slName As String
Dim slFullPath As String
Dim slBuiltIn As String
Dim slGUID As String
Dim slIsBroken As String
Dim slVersion As String
Dim dlKind As String
Dim slDescription As String
Dim slScripting As String
Dim slTemplate As String
Dim slVBIDE As String
Dim slMsg As String
Dim blScripting As Boolean
Dim blTemplate As Boolean
Dim ilN As Integer
Dim olProj As VBProject
subShowMsg sgMsg(140) & sgRefDorthe
For ilN = 1 To Application.VBE.VBProjects.count
Set olProj = Application.VBE.VBProjects(ilN)
If UCase(olProj.Name) = sgRefDorthe Then
Exit For
End If
Next ilN
If IsNull(olProj) Then
slMsg = sgMsg(142)
fncCheckReferences = slMsg
Exit Function
End If
subShowMsg sgMsg(140)
On Error Resume Next
Set olReferences = olProj.References
If Err.Number <> 0 Then
On Error GoTo 0
fncCheckReferences = "VBIDE"
Exit Function
End If
On Error GoTo 0
ilRef = 0
blScripting = False
blTemplate = False
ilRefCount = olReferences.count
subShowMsg sgMsg(135) _
& sgRefScripting _
& " & " _
& sgRefTemplate
slScripting = UCase(sgRefScripting)
slTemplate = UCase(sgRefTemplate)
For Each olRef In olReferences
ilRef = ilRef + 1
slDescription = olRef.Description
slName = UCase(olRef.Name)
slGUID = olRef.GUID
slVersion = olRef.Major & "." & olRef.Minor
Select Case slName
Case slScripting
blScripting = True
Case slTemplate
blTemplate = True
Case Else
End Select
If olRef.isbroken Then
slMsg = slName & " " & sgMsg(89)
fncCheckReferences = slMsg
Exit Function
End If
Next olRef
slMsg = ""
If Not blScripting Then
slMsg = sgRefScripting
End If
If Not blTemplate Then
If slMsg = "" Then
slMsg = sgRefTemplate
Else
slMsg = slMsg & "/" & sgRefTemplate
End If
End If
fncCheckReferences = slMsg
End Function