Showing posts with label Excel VBA References property. Show all posts
Showing posts with label Excel VBA References property. Show all posts

Friday, April 11, 2008

Check Default Reference using Excel VBA

BuiltIn property returns a Boolean value indicating whether or not the reference is a default reference that can't be removed.

Sub If_Reference_Is_Default()

Dim i1
For i1 = 1 To Application.VBE.ActiveVBProject.References.Count

'Returns a Boolean value indicating whether or not the reference is a default reference that can't be removed.
If Application.VBE.ActiveVBProject.References(i1).BuiltIn = True Then
MsgBox "Default Reference : " & Application.VBE.ActiveVBProject.References(i1).name
Else
MsgBox "Not Default Reference : " & Application.VBE.ActiveVBProject.References(i1).name
End If
Next i1

End Sub

Get References of VBA Project Programmtically

Extract References of a VBA Project

The References property returns the set of references in a project. It is an accessor property (that is, a property that returns an object of the same type as the property name).


Sub Get_References_in_Project()

Dim i1
For i1 = 1 To Application.VBE.ActiveVBProject.References.Count

' Get the Name of the Reference
RefName = Application.VBE.ActiveVBProject.References(i1).name

' Get the Description of Reference
RefDesc = Application.VBE.ActiveVBProject.References(i1).Description

'Returns a Boolean value indicating whether or not the Reference object points to a valid reference in the registry. Read-only.
If Application.VBE.ActiveVBProject.References(i1).IsBroken = True Then
RefBroken = True
End If
Next i1

End Sub
Related Posts Plugin for WordPress, Blogger...
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.