AddFromGuid Method

Applies To

References collection.

Description

Adds a reference to the References collection using the globally unique identifier (GUID) of the reference.

Syntax

object.AddFromGuid(guid, major, minor) As Reference

The AddFromGuid syntax has these parts:

Part

Description

object

Required. An object expression that evaluates to an object in the Applies To list.

guid

Required. A string expression representing the GUID of the reference.

major

Required. A Long specifying the major version number of the reference.

minor

Required. A Long specifying the minor version number of the reference.


Remarks

The AddFromGuid method searches the registry to find the reference you want to add. The GUID can be a type library, control, class identifier, and so on.

See Also

Add method, AddFromString method, ItemAdded event, ItemRemoved event, Remove method.

Example

The following example uses the AddFromGuid method to add a reference to the current project, identifying the reference using the globally unique ID value of the Reference object.

Application.VBE.ActiveVBProject.References.AddFromGuid( _
    "{000204EF-0000-0000-C000-000000000046}", 5, 0)