Question : How to Get a List of Access Macro objects in VBA?

I have a fairly simple question:

All I need to do is get a list of Macro objects in VBA. Its clear enough how to get a list of Modules, Tables, Queries, etc.. but for the life of me I cant locate any way to get a list of Macro objects that exist in my current Access database. I'm sure the answer is fairly simple and is on the internet, but I'm not asking the right questions on google or something because I have had no luck.

Answer : How to Get a List of Access Macro objects in VBA?

Macros are an Access object.  As such, you need to use the containers collection.

JimD

Function DoAllMacros()
   
    Dim db As Database
    Dim i
    Set db = DBEngine.Workspaces(0).Databases(0)
    For i = 0 To db.Containers("Scripts").Documents.Count - 1
        Debug.Print db.Containers("Scripts").Documents(i).Name
    Next i

End Function
Random Solutions  
 
programming4us programming4us