On the Development Tools tab, click Record Macro. (If you don't see the Developer tab, see the "Show Developer Tab" below.) )
In the Macro name box, type a name for the macro.
In the shortcut key box, type the shortcut key to use with the Ctrl key to run the macro.
In the storage location for macros box, click the document that you want to use to save the macro.
In the description box, type a description of the macro.
Click OK to start recording the macro.
Executes the action to be included in the macro. On the Development Tools tab, use pause recording as needed.
When you record a macro, you can use the mouse to click Commands and options, or you can work with shapes and objects in the drawing.
To stop recording a macro, on the Development Tools tab, click Stop Recording.
You can also use the buttons on the Recording toolbar to pause or resume macro recording.
To view the generated code, on the Tools menu, point to Macro, click macro, then macro name, and then click Edit.
To display the Development Tools tab
Click the File tab, and then click Options.
Click Customize the Ribbon.
under Customize Ribbon and main tab, select the Development tools check box.
The Developer tab appears at the end of the Ribbon, in a row with the Files tab.
Go from: https://support.office.com/zh-cn/article/recording macro in-visio- -05c29ac5-922d-4fd4-8d60-8e2ccd3ecc5a
Record a macro in Visio