Guid 属性

expandtri全部显示

Reference 对象的 GUID 属性返回一个 GUID,以标识 Windows“注册表”中的类型库String 型,只读。

expression.Guid

expression    必需。返回“应用于”列表中的一个对象的表达式。

说明

GUID 属性仅在使用 Visual Basic 时才可用。

每种类型库都有一个相关的 GUID 保存在“注册表”中。在设置对类型库的引用时,Microsoft Access 将使用类型库的 GUID 来识别类型库。

可以使用 AddFromGUID 方法从类型库的 GUID 创建 Reference 对象。

示例

下面的示例将打印 References 集合内每个 Reference 对象的 FullPathGUIDIsBrokenMajorMinor 属性值:

Sub ReferenceProperties()

    Dim ref As Reference

    ' Enumerate through References collection.

    For Each ref In References

        ' Check IsBroken property.

        If ref.IsBroken = False Then

            Debug.Print "Name: ", ref.Name

            Debug.Print "FullPath: ", ref.FullPath

            Debug.Print "Version: ", ref.Major & "." & ref.Minor

        Else

            Debug.Print "GUIDs of broken references:"

            Debug.Print ref.GUID

        EndIf

    Next ref

End Sub