Using modules

A module contains procedures, data and type declarations, and definitions. Your VBA project does not need to include a module, but there are advantages to doing so. By creating a module, you can include multiple UserForms in your project and you can also run your project as a macro from the Tools menu in BricsCAD or by using the VBARUN command.

To insert and use a module

  1. From the Insert menu in VBA, click Module.
  2. In the Properties window, type a name for your module. (You can also accept the default name Module1, Module2, etc.)
  3. Create code in the Code window just as you would for your controls. Module-level code generally contains just the general statements and macro assignments, as shown in the following code:

Public myVariable as Double

Sub anyMacro ()


End Sub


Tell me about...

VBA (Visual Basic for Applications)

Overview of automation

Starting VBA

Inserting UserForms

Adding controls to a UserForm

Creating code

Managing VBA projects

Running a VBA program


© Bricsys NV. All rights reserved.