Start your Sub and Function with quality code using the Procedure Builder


Using the Code VBA Procedure Builder you can easily create new procedures with the following optional extras, see resulting code below:

You can create new procedures with the standard supporting code in two ways:

  1. In one go by using the Procedure Builder
  2. In separate staps from the Code VBA menu - described below
The fastest way to create a new Sub or function without fuss is by selecting the appropriate one as in image below. The popup (yellow square) shows what code will be inserted. The cursor is before the () so you can start typing the function name. declare function fast
Procedure Builder

The Procedure Builder

The Procedure Builder (screenshot) can be started from the toolbar start Procedure Builder from toolbar or accessed directly in the Code Builder dockable window - if you have choosen to keep that permanently available.

If you specify the Type, the procedure is declared as Function, else as Sub. The Type groupbox contains a textbox and a listbox. The listbox lists the most commonly used types of VBA (String, Integer,...) and the Office application you work with (Excel: Worksheet, Range,...). By clicking one of the listed types the textbox obtains that type as value. However this being a textbox, you are free to specify a different type not listed, e.g. MyType - if that is defined.

In the Body groupbox you can select the Error handler, and check the additional features you want to include.

Creating the procedure code in separate steps using Code VBA menu

Click this Start demo screencast to see how easy it is to do this with Code VBA menu

Using the two Code VBA approaches the code below is created.

Function IsMember(strName As StringAs Boolean
'Purpose    :
'Author     :
'Date       :

    On Error GoTo HandleError
    IsMember = False
    Exit Function
    ErrorHandle Err, Erl()
    Resume HandleExit
End Function