Hack 17 Make Styles More Manageable with Aliases![]() ![]() speed up your formatting time.To quickly apply a style to selected text, put your cursor in the Styles pull-down menu on the Formatting toolbar, type in the style name, and press Enter.
type, as shown in Figure 3-12. This feature helps if you're applying, say, the Heading 1 style, but it's not much of a shortcut for any of the other heading styles. Figure 3-12. Word attempts to automatically complete the style's name as you type![]() built-in styles, but if you create an alias to a style (such as "h6" for the Heading 6 style), you can type the alias instead of the style's "real" name into the Styles pull-down menu.To create an alias for a style, select Format Formatting, click the desired style, and choose Modify. Put a comma at the end of the style's name, and then put the alias after the comma (don't include a space after the comma, or it will be interpreted as the first character of your alias's name). Figure 3-13 shows you how to create an alias for the Heading 6 style. Figure 3-13. To create an alias for a style, just put the alias after a comma at the end of the style's name![]() "h6" in the Styles pull-down menu and press Enter.
provide alternate descriptions of a style. For example, if you set up your document to use the Heading 1 style for chapter titles, you might consider adding an alias so the style's called "Heading 1,Chapter."Strings of aliases after each style can look a bit strange in the Styles pull-down menu (see Figure 3-14). But if you use the aliases, you'll rarely see the menu anyway. Figure 3-14. A list of styles with multiple aliases![]() 3.5.1 Using Aliases in VBAWhen you apply a style from a macro, you can use its "real" name, any of its aliases, or its full name, including all of its aliases. For example, if the Heading 6 style had an alias of "h6," as described above, any of the following would apply it to the paragraph referenced by the variable para: para.Style = "Heading 6"Because Heading 6 is one of Word's built-in styles, the following also works: para.Style = wdStyleHeading6You can quickly remove all aliases in a document with a simple macro if, for example, you added aliases to someone else's document while you edited it: Sub RemoveAllStyleAliasesThe Split function used in this manner just removes everything after, and including, the first comma in the style name. If the style doesn't have any aliases, it leaves the name as is. |