office交流网--QQ交流群号

Access培训群:792054000         Excel免费交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

Access vba查看所有引用

2017-12-30 16:17:00
十段
转贴
5858

在VBE窗口中,我们可以通过工具-引用,引用相关的库类文件。只有引用了才能调用。


在引用一些库类时,往往是本地计算机有,在其他未必有。所以我们需要判断有成功引用对象。

在VBA中, 通过一个自定义的函数来查看所有引用。

Function ReferenceInfo()
   Dim strMessage As String
   Dim strTitle As String
   Dim refItem As Reference
   
   On Error Resume Next
   
   For Each refItem In References
      If refItem.IsBroken Then
         strMessage = "Missing Reference:" & vbCrLf & refItem.FullPath
      Else
         strMessage = "Reference: " & refItem.Name & vbCrLf _
            & "Location: " & refItem.FullPath & vbCrLf
      End If
      Debug.Print strMessage
   Next refItem
End Function

获取引用对象

    分享