Collections (Visual Basic Add-In Model)
A collection is an object that contains a set of related objects. An object's position in the collection can change whenever a change occurs in the collection; therefore, the position of any specific object in the collection can vary.
The following sections describe the collections in the Visual Basic Add-In Model.
The AddIns collection is accessed through the VBE object. Every add-in listed in the Add-In Manager in VBE has an object in the AddIns collection.
Use the CodePanes collection to access the open code panes in a project.
You can use the Count property to return the number of active code panes in a collection.
Contains all of the command bars in a project, including command bars that support shortcut menus.
Use the CommandBars collection to enable add-ins to add command bars and controls, or to add controls to existing, built-in, command bars.
Objects, properties, and methods for controlling linked windows, linked window frames, and docked windows are included on the Macintosh for compatibility with code written in Windows. However, these language elements will generate run-time errors when run on the Macintosh.
The LinkedWindowFrame property of the Window object returns a Window object that has a valid LinkedWindows collection.
If all the panes from one linked window frame are moved to another window, the linked window frame with no panes is destroyed. However, if all the panes are removed from the main window, it isn't destroyed.
Use the Visible property to check or set the visibility of a window.
You can use the Add method to add a window to the collection of currently linked windows. A window that is a pane in one linked window frame can be added to another linked window frame. Use the Remove method to remove a window from the collection of currently linked windows; this results in the window being unlinked or undocked.
The LinkedWindows collection is used to dock and undock windows from the main window frame.
Represents the properties of an object.
Represents the set of references in the project.
Use the References collection to add or remove references. The References collection is the same as the set of references selected in the References dialog box.
See also the VBProject object.
Represents the components contained in a project.
Use the VBComponents collection to access, add, or remove components in a project. A component can be a form, module, or class. The VBComponents collection is a standard collection that can be used in a For...Each block.
You can use the Parent property to return the project that the VBComponents collection is in.
Represents all of the new projects in the development environment.
Use the VBNewProjects collection to access specific projects in an instance of the development environment. VBNewProjects is a standard collection that you can iterate through by using a For...Each block.
Represents all the projects that are open in the development environment.
Use the VBProjects collection to access specific projects in an instance of the development environment. VBProjects is a standard collection that can be used in a For...Each block.
Contains all open or permanent windows.
Use the Windows collection to access Window objects.
The Windows collection has a fixed set of windows that are always available in the collection, such as the Project window, the Properties window, and a set of windows that represent all open code windows and designer windows.
Opening a code or designer window adds a new member to the Windows collection. Closing a code or designer window removes a member from the Windows collection. Closing a permanent development environment window doesn't remove the corresponding object from this collection, but results in the window not being visible.
- Drives collection
- Files collection
- Folders collection
- Collections (Microsoft Forms)
- Visual Basic Add-in Model reference
- Visual Basic language reference
- Office client development reference
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.