download
order Bookmark and Share  

 

 

Property Builder

 
Accessibility Static Property Name DataType Description Options Module OK OK  New Cancel Help

Adding Property procedures as part of programming classes is time consuming. A typical piece of code looks like this:

Private msColorText As String
Public Property Get ColorText() As String
    ColorText = msColorText
End Property
Public Property Let ColorText(rData As String)
    msColorText = rData
End Property

The Property Builder creates this code and more, depending on the extra options you selected.

Start this dialog from the Code Explorer, Toolbar or using Alt-CPA (Code-vb - Property - Add)

Alternative: use fast declaration if you only need simple procedure level variables thru menu: Property > {property  type}

Controls:


Accessibility

Select if a variable is to be Public or Private.

Static

If selected all variables in the procedure will keep their value between calls.

Property

Get Let/Set

Check which procedure you want: Get, Let/Set or both. The builder decides itself if it needs to use Set (with objects) or Let.

Get

Return the value of the property

Let/Set

Set the value of the property.

Name

Name of the Property. Don't use prefix in the name.

Type

Type of the property.

Description

For those professional developers who take documenting code seriously :). The description is added after the declaration.

Options

Header Hourglass Procedure Constant Module Constant AddErrorHandler

You can determine what is the default behavior on the Settings dialog

Header

Whether to include procedure header text or not.
You have to determine in each case if you want this additional text.

Hourglass

If the process involved with the property is lengthy, it makes sense to add Hourglass.

Procedure Constant

If checked insert procedure constant at top of procedure of not yet present.

Const cstrProcedure = "MyProcedure"

Module Constant

If checked insert module constant at top of module of not yet present.

Private Const cstrModule As String = "ThisWorkbook"

Add Error Handler

Select what error handling, if any, you want added from the combo box.
The default is set in Settings.

Module

If you use global variables (accessibility) and keep them in an other then the current module. You can select this module here, which saves you a trip to the other module and back.

OK

Creates the property get/let.

OK & Paste

Creates the property get/let and pastes the property name at the cursor position.

Cancel

Closes the builder without creating the property.

Help

Starts this Help topic.