References.AddFromGUID method (Access)

The AddFromGUID method creates a Reference object based on the GUID that identifies a type library. Reference object.

Syntax

expression.AddFromGUID (Guid, Major, Minor)

expression A variable that represents a References object.

Parameters

Name Required/Optional Data type Description
Guid Required String A GUID that identifies a type library.
Major Required Long The major version number of the reference.
Minor Required Long The minor version number of the reference.

Return value

Reference

Remarks

The GUID property returns the GUID for a specified Reference object. If you stored the value of the GUID property, you can use it to re-create a reference that's been broken.

If you add a GUID reference using 0 for both the major and minor version parameters, it will resolve to the latest installed version of an object library.

Example

The following example re-creates a reference to the Microsoft Scripting Runtime version 1.0, based on its GUID on the user's system.

References.AddFromGuid "{420B2830-E718-11CF-893D-00A0C9054228}", 1, 0

The following example adds a reference to the Microsoft Excel Object Library, without knowing which version is currently installed.

References.AddFromGuid "{00020813-0000-0000-C000-000000000046}", 0, 0

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.