You can create a macro in one of the following ways:
–Record a sequence of actions that a macro should consist of.
–Enter the macro code manually.
–Convert the VBA macro code into a new macro with similar code in Lua.
To record a macro, do the following:
1.Start recording in one of the following ways:
•On the Macros tab, click
Record macro (beta).
•When working in macOS, select the Tools > Macros > Record macro (beta) command from the command menu.
•If the document contains at least one macro in the Lua language, on the Sidebar, click
Macros. In the Macros pane, click the
button to the right of the New macro button. In the drop-down list, select Record macro (beta).

2.Perform a sequence of actions that a macro should consist of.
3.Complete the recording in one of the following ways:
•On the Macros tab, click
Stop recording macro.
•When working in macOS, select the Tools > Macros > Stop recording macro command from the command menu.
•If the document contains at least one macro in the Lua language, on the Sidebar, click
Macros. In the Macros pane, click the
button to the right of the New macro button. In the drop-down list, select Stop recording macro.

•On the Status bar, click
Stop recording.

4.In the opened dialog box, specify the macro name and click OK.
If the macros has been successfully saved, the following pop-up message will be displayed on the screen: “"Macro_name" macro saved”.
To enter the code of a macro manually:
1.Create a new macro using one of the following methods:
•On the Macros tab, click
Macro editor. When working in macOS, you can also run the Tools > Macros > Macro editor command from the command menu. In the Macro editor window, click
.

•If the document contains at least one macro in the Lua language, on the Sidebar, click
Macros. In the Macros pane, click New macro.

2.Enter a name for the macro or leave the default name. To save the name, press Enter or click anywhere in the Macro editor.

3.Enter the code of the macro.
The new macro will be saved automatically.
When you add the first macro in Lua to the document, the
Macros button appears on the Sidebar. This button is displayed as long as there is at least one macro written in Lua in the document.
Click
Macros to open the Macros pane.

To close the Macros pane, click
Close at the top of the pane, or click
Macros button on the Sidebar again.