Word Hacks [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Word Hacks [Electronic resources] - نسخه متنی

Andrew Savikas

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







Hack 17 Make Styles More Manageable with Aliases

Assigning short nicknames to styles can really
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.


To instantly move your cursor into the Styles pull-down menu, press
Ctrl-Shift-S.

In fact, Word will even attempt to complete the style name as you
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

You can't rename any of Word's
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 FormatStyles and
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

Now, to apply the Heading 6 style, just enter
"h6" in the Styles pull-down menu
and press Enter.


Styles can have multiple aliases, but no two styles can have the same
alias.

In addition to creating shortcut names for styles, aliases can
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 VBA


When 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"
para.Style = "Heading 6,h6"
para.Style = "h6"
para.Style = "h" & CStr(6)

Because Heading 6 is one of Word's built-in styles,
the following also works:

para.Style = wdStyleHeading6

You 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 RemoveAllStyleAliases
Dim sty As Style
For Each sty In ActiveDocument.Styles
sty.NameLocal = Split(sty.NameLocal, ",")(0)
Next sty
End Sub

The 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.


/ 162