Table of contents
Collapse the table of content
Expand the table of content

Add Method (VBA Add-In Object Model)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Adds an object to a collection. Syntaxobject.Add(component) The Add syntax has these parts:

objectRequired. An object expression that evaluates to an object in the Applies To list.
componentRequired. For the LinkedWindows collection, an object. For the VBComponents collection, an enumeratedconstant representing aclass module, a form, or a standard module. For the VBProjects collection, an enumerated constant representing a project type.

You can use one of the following constants for the component argument:

vbext_ct_ClassModuleAdds a class module to the collection.
vbext_ct_MSFormAdds a form to the collection.
vbext_ct_StdModuleAdds a standard module to the collection.
vbext_pt_StandAloneAdds a standalone project to the collection.

Remarks For the LinkedWindows collection, the Add method adds a window to the collection of currentlylinked windows.

Note You can add a window that is a pane in one linked window frame to another linked window frame; the window is simply moved from one pane to the other. If the linked window frame that the window was moved from no longer contains any panes, it's destroyed.

Important 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 generate run-time errors when run on the Macintosh.

For the VBComponents collection, the Add method creates a new standard component and adds it to theproject. For the VBComponents collection, the Add method returns a VBComponent object. For the LinkedWindows collection, the Add method returns Nothing. For the VBProjects collection, the Add method returns a VBProject object and adds a project to the VBProjects collection.

© 2017 Microsoft