View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default VBE References List

You might find this useful:

Sub ListAddinReferences()

'to list all the references installed in the add-in
'--------------------------------------------------

Dim i As Integer
Dim iRefCount As Integer

Range(Cells(1), Cells(iRefCount + 1, 6)).Clear

iRefCount = ThisWorkbook.VBProject.References.count

Cells(1).Value = "Name"
Cells(2).Value = "Description"
Cells(3).Value = "FullPath"
Cells(4).Value = "GUID"
Cells(5).Value = "Major"
Cells(6).Value = "Minor"

With ThisWorkbook.VBProject.References
For i = 1 To iRefCount
Cells(i + 1, 1).Value = .Item(i).Name
Cells(i + 1, 2).Value = .Item(i).Description
Cells(i + 1, 3).Value = .Item(i).FullPath
Cells(i + 1, 4).Value = .Item(i).GUID
Cells(i + 1, 5).Value = .Item(i).Major
Cells(i + 1, 6).Value = .Item(i).Minor
Next i
End With

Range(Cells(1), Cells(6)).Font.Bold = True
MediumBorder Range(Cells(1), Cells(6))
Range(Cells(1), Cells(iRefCount + 1, 6)).Columns.AutoFit

End Sub


RBS


"VBA Dabbler" wrote in message
...
Does anyone know how to get a list of the libraries available on a machine
using VBA scripting? (That is the list you see when you go to
Tools\References in VBE.)

I've developed some code which requires certain libraries be
present/active,
and would like to do some preliminary work to verify and take corrective
action, if needed.

What I used so far within a For Loop is:

'ActiveWorkbook.VBProject.References.Item(i).Name'

This gives me a substantially truncated response which may be the same for
different library versions.

Regards,
VBA Dabbler