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:
- Sub or Function procedure with return argument of selected type
- Error handling code inserted into the procedure
- Error handler module added - in case you selected Error handling with email support
- Procedure comments header included
- Return statement added (enabled only in case of Function procedures)
- Hourglass for procedures that run longer to indicate it is still processing
You can create new procedures with the standard supporting code in two ways:
- In one go by using the Procedure Builder
- In separate staps from the Code VBA menu - described below
|The fastest way to create a new |
The Procedure Builder
The Procedure Builder (screenshot) can be started from the 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 to see how easy it is to do this with Code VBA menu
Function IsMember(strName As String) As Boolean 'Purpose : 'Author : 'Description: 'Date : On Error GoTo HandleError IsMember = False HandleExit: Exit Function HandleError: ErrorHandle Err, Erl() Resume HandleExit End Function