Property Set Statement

Named Arguments

No

Syntax

[Public | Private | Friend] [Static] Property Set name _
         ([arglist,] reference)
   [statements]
   [Exit Property] 
   [statements]
End Property

Public

Use: Optional

Type: Keyword

Gives the property scope through all procedures in all modules in the project. If used within a createable class module, the function is also accessible from outside the project. Public, Private, and Friend are mutually exclusive.

Private

Use: Optional

Type: Keyword

Restricts the scope of the property to those procedures in the same module. Public, Private, and Friend are mutually exclusive.

Friend

Use: Optional

Type: Keyword

Only valid within a class module; gives the property scope to all modules within a project, but not to modules outside the project. Public, Private, and Friend are mutually exclusive.

Static

Use: Optional

Type: Keyword

Preserves the value of all private variables declared inside the property between calls to the property.

name

Use: Required

Type: Any

The name of the property.

arglist

Use: Required

A comma-delimited list of variables to be passed to the property as arguments from the calling procedure.

reference

Use: Required

Type: Object

The last (or only) argument in arglist, which is a variable containing the object reference to be assigned to the property.

statements

Use: Optional

Program code to be executed within the property.

arglist uses the following syntax and parts:

[Optional] [ByVal | ByRef] [ParamArray] varname[( )] _
           [As type

Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.