Option Private Module Statement

Syntax

Option Private Module

Description

Restricts the scope and visibility of the contents of a module (i.e., its variables, classes, functions, and procedures) in VBA-enabled applications that allow references across multiple projects (e.g., Microsoft Office applications) to the module's project. Option Private Module has no effect in the standalone version of Visual Basic.

Rules at a Glance

  • The Option Private Module statement must appear in the declarations section of a module before any procedures.

  • Publicly declared procedures, variables, and objects contained within a module that has been set as private using the Option Private Module statement aren't available to other projects and applications. However, they are still available in the usual way to other members of the same project.

Programming Tips and Gotchas

You should only use the Option Private Module statement in applications such as Microsoft Excel that allow you to load multiple projects. In this way, the Option Private Module statement restricts visibility of publicly declared items.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.124.24