Naming convention for VBA modules?

I never know what to call VBA modules. Should I:

  • Use a prefix like basName or modName.
  • Do not use a prefix, such as a module. (But avoid limited words)
  • Something else
+4
source share
4 answers

Not a prefix! Name the module appropriately for what it does.

+3
source

Of course, this takes the car back, but when I did extensive VBA development, I always called my modules a prefix of something like "bas", because the names of the class modules and Global modules in combination had to be unique (i.e. you there could not be a global module named Foo and a Class module named Foo). I think the same goes for VB6, but that was many years ago.

+2
source

I prefix standard modules with M, class modules with C, and custom forms with U. In VBE, I turn off the folder view in the project explorer to show all the modules. Prefixes keep them beautifully sorted.

+1
source

The prefix can be useful only so that neighboring modules are displayed next to each other in the project window. I use prefixes like "numeric" or "test" all the time instead of another way to group them. But you probably don't need something like a “mod” ...

0
source

Source: https://habr.com/ru/post/1306539/


All Articles