Example: Assigning Macros to Shortcut Keys
From Apache OpenOffice Wiki
< Documentation | AOO4 User Guides/Writer Guide | Customizing Writer | Assigning Shortcut Keys
Revision as of 10:18, 12 October 2025 by DiGro (talk | contribs) (→Example: Assigning Macros to Shortcut Keys)
Example: Assigning Macros to Shortcut Keys
A common use for assigning macros to shortcut keys is to enable quick and easy insertion of special characters. This example shows how to set up keyboard shortcuts for inserting en dashes and em dashes. The en dash is approximately the length of the letter N, and the em dash the length of the letter M. The shorter en dash (–) is used to mark ranges and with the meaning “to” in phrases like “Dover–Calais crossing.” The longer em dash (—) is used to separate extra information or mark a break in a sentence. First, you need to record a macro for inserting each type of dash. Then, you need to assign those macros to shortcut key combinations.
| no1. Choose Tools → Macros → Record Macro to start recording a macro.
novieA small window is displayed, so you know that OpenOffice is recording. |
|
- Choose Insert → Special Characters to open the Special Characters dialog box. Scroll down until you find the en dash (U+2013) and em dash (U+2014) characters. Select one of them and click OK .
- Click the Stop Recording button to stop recording, save the macro, and display the OpenOffice Basic Macros dialog box (see Figure 9). Type a descriptive name for the new macro in the Macro name box on the upper left.
- 4) Be sure to open the library container named My Macros. Find the library named Standard under My Macros. Select Module1 and click Save . The libraries listed under My Macros on your system will likely be different from those shown in the figure, but Standard will always be present.
- Repeat steps 1–4 to create other macros, for example to insert an em dash.
- Choose Tools → Customize → Keyboard tab (Figure 10). In the Shortcut keys list, pick an unused combination (for example, Ctrl + ⇧ Shift + N for an en dash). In the Category list, scroll down to OpenOffice Macros, click the + sign (or small triangle, depending on your operating system), then click the + (or triangle) next to user and then next to the Standard library and select Module1. In the Function list, pick endash and click the Modify button on the upper right. The selected key combination now appears in the Keys list on the lower right, and endash appears next to Ctrl + ⇧ Shift + N in the Shortcut keys list.
- Repeat for the em dash macro, then click OK .
| For inserting en and em dashes, and other special characters, you may find extensions such as Compose Special Characters useful. See “Adding Functionality with Extensions”. |
