Using Macros to Automate Tasks

23.08.2021

What Is a Macro?

If you want to repeat a task in FlexPro, you can automate it using a macro. A macro consists of a series of FlexPro commands and statements grouped into a single command for automating a task. Instead of manually carrying out a series of time-consuming, repeated actions in FlexPro, you can create and run a single macro, which is a custom command that carries out the required task.

Macros are typically used for purposes such as the following:

Speeding up editing and formatting tasks

Combining several commands, such as commands for importing data and creating a diagram

Providing better access to an option in a dialog box

Automating a Complex Series of Tasks

FlexPro offers two ways to create macros. You can record a macro or use the Visual Basic Editor. The Visual Basic Editor is only available in FlexPro Professional and Developer Suite.

Recording a Macro

Recording a macro is the easiest way to create a macro. Even if you work with FlexPro Professional or FlexPro Developer Suite and you have Visual Basic Editor available for programming, it makes sense to start first with a macro recording and then modify the code as necessary. A macro is recorded in FlexPro as a series of FlexPro commands in Visual Basic for Applications. When recording macros, you can select commands and options using your mouse. You can halt recording of the macro at each step and later resume where you stopped.

To make things easier, you can use the Quick Macro in FlexPro for repetitive processes. You can easily start and stop recording this macro using the shortcut CTRL+SHIFT+R. You do not have to name or create this macro. If you want to start a new recording, any existing Quick Macro will be deleted automatically. You can run the Quick Macro as often as you like using the shortcut CTRL+SHIFT+P.

To make it easy for you to access a saved macro by name, you can add the macro to the ribbon or Quick Access Toolbar, or assign a keyboard shortcut to it. To run the macro you then only have to click on its ribbon icon or toolbar, or press the shortcut keys. You can also select Developer[Code] > Macros and then click on the name of the macro you want to run.

Creating a New Macro

Using the Visual Basic Editor in FlexPro Professional or FlexPro Developer Suite, you can create powerful custom macros with Visual Basic statements that cannot be recorded.

Where Macros Are Stored

You can save macros in template databases or in project databases. By default, FlexPro macros are saved in the personal template database so that they are available to all FlexPro project databases. If you only want to use a macro for a particular project database, save that macro to the specific project database. Individual macros in a project database are saved in macro projects which you can copy between project databases.

See Also

Creating a Macro

Customizable User Interface

Share article or send as email:

You might be interested in these articles