1. Description

    In the attached article you will find some general VBA programming guidelines, which are recommended to be used for programming with PrintMachine Visual Basic for Applications.

  2. Answer

    The article suggests some basic guidelines for programming in VBA (VisualBaisc for Applications). The guidelines mainly follow
    the ISO 9241 standards (see also http://en.wikipedia.org/wiki/ISO_9241). The major topics are:

    Add comments:

    • Comment all variables, their usage and possible range;
    • Comment all procedures and functions, add a short description of the purpose;
    • At the beginning list all changes and the reason for the change; add project, customer and date of agreement for the change.


    • Provide names for Procedures, Function, Variables etc with a clear indication of the meaning;
    • Follow the REDDICK conventions for control elements, variables and constants;
    • Follow the common VBA rules (see Microsoft Knowledge Base).

    Error handling:

    • Provide complete error handling with comprehensible, meaningful error messages;
    • Check objects whether they are empty or Zero before processing (especially when using databases);
    • Avoid "On Error Resume Next".


    • Make your code easy to understand;
    • Use one command per line;
    • Use of 'Select Case' is better than multiple 'If';
    • Avoid Gotos and Exits if possible.

    User Interface:

    • Make them look and feel similar to standard Microsoft applications;
    • Don't overload, use dialogue boxes;
    • Use one simple font;
    • Deactivate or hide control elements if not applicable;
    • Build functional groups for elements belonging together;
    • Avoid messages with typos.

    Data output:

    • Check prerequisites before providing data for output;
    • Store data: change mouse cursor to "working" if it take some time;
    • Use status bar to inform (where applicable).

    Test your program:

    • Have other programmes testing your program;
    • Use test data also from other sources than yours;
    • Provide test results including expected vs received results.

Date created:
01/22/2015 11:38:32
Last updated:
02/11/2015 10:25:50