4.1 Projects

A project is the unit in which VBA program code is defined and incorporated into a VBA Environment. Logically a project consists of a project name, a set of named modules, and an ordered list of project references. A project reference that occurs earlier in this list is said to have higher reference precedence than references that occur later in the list. The physical representation of a project and the mechanisms used for naming, storing, and accessing a project are implementation-defined.

A project reference specifies that a project accesses public entities (section 2.2) that are defined in another project. The mechanism for identifying a project’s referenced projects is implementation defined.

There are three types of VBA projects: source projects, host projects, and library projects. Source projects are composed of VBA program code that exists in VBA Language source code form. A library project is a project that is defined in an implementation-defined manner that and can define all the same kinds of entities that a source project might define, except that it might not exist in VBA language source code form and might not have been implemented using the VBA language.

A host project is a library project that is introduced into a VBA Environment by the host application. The means of introduction is implementation dependent. The public variables (section 5.2.3.1), constants, procedures, classes (section 2.5), and UDTs defined by a host project are accessible to VBA source projects in the same VBA Environment as if the host project was a source project. An open host project is one to which additional modules can be added to it by agents other than the host application. The means of designating an open host project and of adding modules to one is implementation defined.

Static Semantics.

  • A project name MUST be valid as an <IDENTIFIER>.

  • A project name SHOULD NOT be "VBA"; this name is reserved for accessing the VBA Standard Library (section 2.7.1).

  • A project name SHOULD NOT be a <reserved-identifier>.

  • The project references of a specific project MUST identify projects with distinct project names.

  • It is implementation dependent whether or not a source project references a different project that has the same project name as the referencing project.