3 4
You can run your Microsoft Visual Basic for Applications (VBA) code within the Visual Basic Editor to test and debug it during development. This section discusses several ways to run your code in the Visual Basic Editor. For details about debugging a VBA program, such as adding breakpoints, adding watch expressions, and stepping into and out of execution, see the Microsoft Visual Basic Help.
A user can run your finished macros in the Microsoft Visio user interface by choosing it from the Macros submenu on the Tools menu. A macro is a VBA procedure that takes no arguments. Procedures that take arguments will not appear on the Macros submenu.
Figure 15-11 Macros dialog box.(A) Name of the selected macro. (B) List of available macros and add-ons. (C) List of accessible projects, modules, and drawings.
A program can also run in response to events or in other ways that you design. For details about running a program in response to events, see Chapter 21, Handling Visio Events. For other ways to run a program, see Chapter 26, Packaging a Visio Automation Solution.
If the macro you want is not listed, make sure you've chosen the correct project, module, or drawing in the Macros In list. Private procedures do not appear in any menus or dialog boxes.
Or,
The macro that contains the insertion point runs.
Note
The following illustration shows how a module might appear on the Visio Macros submenu, with its macros displayed on the module's submenu.
Figure 15-12 Visio Macros submenu.
If you want your macros to appear on the Macros submenu, but not the module that contains your macros, name your module ShowInMenu. The ShowInMenu module does not appear on the Visio Macros submenu, but its macros do, as shown in the following illustration.
Figure 15-13 Macros submenu showing a macro from the ShowInMenu module.