套用到
Microsoft 365 Access Access 2024 Access 2021 Access 2019 Access 2016

適用對象

Reference 物件

Reference 物件的 GUID 屬性會傳回用於在 Windows 登錄中識別類型程式庫的 GUID。 唯讀 String

expression.Guid

運算式 必要。 傳回 [套用至] 清單中其中一個對象的表達式。

備註

GUID 屬性只能在使用 Visual Basic for Applications (VBA) 程式碼時取得。

每個類型程式庫都有關聯的 GUID (儲存在登錄中)。 當您設定類型文檔庫的參照時,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

需要更多協助嗎?

想要其他選項嗎?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。