Procedure Builder

StaticAccessibilityTypeNameProcedure Arguments+-áâReturn Value TypeDescriptionOptionsModuleOKCancelHelp

Look at the example code generation to see what Procedure Builder can do you for you.

Start this dialog from the Code Explorer, Toolbar or using Alt-CR (Code-vb - P rocedure)

Controls:


Static

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

Accessibility

Select if a variable is to be Public or Private or procedure or module level or part of the interface.

Type

Sub or Function (returns value).

Name

Name of the procedure.

Procedure Arguments

Arguments of the procedure.

+

Add argument

-

á

Move selected argument one position up.

â

Move selected argument one position down.

Return Value Type

Type of the value that is returned in case of a function

Description

For those professional developers who take documenting code seriously :). The description is added below the procedure interface it is part of , e.g.

Sub ProcessFile(sFile as String)
' File to be processed

Options

Add Return StatementHeaderHourglassArguments on Separate LineProcedure ConstantModule ConstantError Handler

Procedures contain quite a lot of repetitive statement. This group box lets you determine in each case you are adding a procedure which lines to include and which not.

Add Return Statement

In case it is a function there will at least be one statement determining the value to be returned. Check this and such a statement gets inserted:

Function MyFunction() As String
    MyFunction =
End Function

Header

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

Function MyFunction() As String
    MyFunction =
End Function

Hourglass

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

Arguments on Separate Line

Determines if all arguments are placed on the same line ...

Sub MySub (Arg1, Arg2, ...)
... or each on a new line
Sub MySub (Arg1, _
                Arg2, _
                 ...)

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"

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 constants ( 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

Create the procedure.

Cancel

Closes the builder without creating the constant .

Help

Starts this Help topic