I'm wondering if it is possible for Access VBA to give a listing of all the open Document Tabs in the current instance of Access. I have code that can check every Access object and report if it is loaded. It's fast but feels like a backwards approach. It also is unable to list unsaved objects, like a new query. Also, I can't tell which objects are showing a tab. A popup window does not have a tab.
Is there a VBA routine that can list all of the Tabbed Documents?
Public Sub ListAllOpenObjects()
' This will list all open Access objects. It will not list
' objects that are new that have not be saved, like Query1.
Dim aob As AccessObject
With CurrentData
' "Tables"
For Each aob In .AllTables
If aob.IsLoaded Then
Debug.Print aob.name
End If
Next aob
' "Queries"
For Each aob In .AllQueries
If aob.IsLoaded Then
Debug.Print aob.name
End If
Next aob
End With
With CurrentProject
' "Forms"
For Each aob In .AllForms
If aob.IsLoaded Then
Debug.Print aob.name
End If
Next aob
' "Reports"
For Each aob In .AllReports
If aob.IsLoaded Then
Debug.Print aob.name
End If
Next aob
' "Pages"
For Each aob In .AllDataAccessPages
If aob.IsLoaded Then
Debug.Print aob.name
End If
Next aob
' "Macros"
For Each aob In .AllMacros
If aob.IsLoaded Then
Debug.Print aob.name
End If
Next aob
' "Modules"
For Each aob In .AllModules
If aob.IsLoaded Then
Debug.Print aob.name
End If
Next aob
End With
End Sub