VBA naming conventions

It is useful to prefix variables so as to indicate their type:

Common prefixes are: str (String), int (Integer), dt (Date), boo (Boolean), var (Variant), obj (Object), c for constant andarr for array.

To get intellisense popup, type the prefix and Ctl-[space]

Click this Start demo screencast to see how intellisense displays variables in your code that have the prefix you typed.Name file string selection demo

Many programmers use the Reddick's naming conventions ( http://www.xoc.net/standards/rvbanc.asp ) or a shorter version you developed yourself. Code VBA supports Reddick as a default, but lets you customize it to fit your needs.

Support of the naming conventions consists of automatically adding the appropriate prefix (optional). Considering the number of classes that may be used - 300+ in Excel -, not every type has a prefix defined. We implemented an algorithm that proposes a prefix in case it is not present in the prefixes file. If you don't like it, add a better one to the file.e.

To change or add prefixes open the file that contains the prefixes:

the prefixes are stored in a file called prefix.txt. Below you see a bit of it's content.

Class=cls
Collection=col
Module=m
Global=g
Const=c
ByRef=r
ByVal=v
Array=arr
Constant=c
AccessObject=aob
AccessObjectProperties=aops
AccessObjectProperty=aop
Animation=ani
Application=app
Band=bnd
Bands=bnds