VBE References List

V

VBA Dabbler

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
 
R

RB Smissaert

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
 
V

VBA Dabbler

Yes, I did find it useful - thanks.

Do you know how to get a list of references that are available on the
machine running VBA code?

Regards,
VBA Dabbler
 
C

Chip Pearson

As far as I know, there is no way to get the list of all
available references. You can only get those that are in use.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


message
 
V

VBA Dabbler

I presume you are referring to within VBA. Do you think that a list of all
available references could be retrieved via API calls?

Regards,
VBA Dabbler
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top