Most collection objects are accessed through the Document object. The Document object contains a property for each of the Collection objects.
For example, the following code defines a variable and sets it to the Layers collection of the current drawing:
Dim layerCollection as AcadLayers Set layerCollection = ThisDrawing.Layers
The Documents collection, MenuBar collection, and MenuGroups collection are accessed through the Application object. The Application object contains a property for each of these collections. For example, the following code defines a variable and sets it to the MenuGroups collection for the application:
Dim MenuGroupsCollection as AcadMenuGroups Set MenuGroupsCollection = ThisDrawing.Application.MenuGroups