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

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

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

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

Andrew Savikas

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

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

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







Hack 49 Quickly Attach a Workgroup Template

It's a rare corporate Word
user who knows offhand the location of her Workgroup templates on the
network. Word knows where they are, but try attaching one to an
existing document, and you get a pop quiz on the subject! Reeducate
Word with this hack.

In addition to templates
stored locally, Word allows you to
specify a location for document templates on a network, called the
Workgroup templates folder. This feature is
especially useful in a corporate environment, where multiple users
may share the same set of templates.

When you specify a Workgroup templates location (select
ToolsOptions and click the File Locations tab), Word kindly
adds any appropriate tabs to the Templates dialog the next time you
choose FileNew. But Workgroup templates
aren't as easily integrated into your routine when
it comes to attaching them to existing documents.

The Templates and Add-Ins dialog (ToolsTemplates and
Add-Ins), shown in Figure 5-8, defaults
to your local
templates folder when you click the Attach button (actually, it goes
to the folder you specified for User templates under Tools
Options File Locations). So if you regularly attach both
local and Workgroup templates, you're in for a lot
of folder browsing.


Figure 5-8. If you click the Attach button, Word takes you to the User templates folder


5.6.1 The Code


Word's Options object has a
DefaultFilePath property that represents the value
assigned to the User templates folder. If you temporarily set this to
the Workgroup templates folder, you also change where you end up when
you click the Attach button in the Templates and Add-Ins dialog.

This hack uses the techniques described in [Hack #63] .

Sub AttachWorkGroupTemplate( )
Dim sWorkgroupTemplateFolder As String
Dim sUserTemplatesFolder As String
Dim dial As Dialog
Set dial = Dialogs(wdDialogToolsTemplates)
sUserTemplatesFolder = Options.DefaultFilePath(wdUserTemplatesPath)
sWorkgroupTemplateFolder = Options.DefaultFilePath(wdWorkgroupTemplatesPath)
If Len(sWorkgroupTemplateFolder) = 0 Then
MsgBox "No workgroup templates location has been specified." & vbCr & _
"To specify one, go to Tools -> Options -> File Locations.", _
vbExclamation
Exit Sub
End If
Options.DefaultFilePath(wdUserTemplatesPath) = sWorkgroupTemplateFolder
If dial.Display = -1 Then
dial.Linkstyles = True
dial.Execute
End If
Options.DefaultFilePath(wdUserTemplatesPath) = sUserTemplatesFolder
End Sub

The macro ignores the "Automatically update document
styles" box in the Templates and Add-ins dialog and
updates the styles regardless of the value set in the box. Most
corporate users are instructed to update their documents to reflect
any changes to the template, but if you'd rather
decide manually, remove or comment out the following line:

dial.Linkstyles = True


When you run this macro, clicking the OK button on
any of the tabs in the Templates and Add-Ins
dialog is the same as clicking the OK button on the Templates tab.
For more information, see [Hack #63] .


5.6.2 Running the Hack


Put this macro into the template of your choice [Hack #50]
and put a button for it on the Tools menu, right below the Templates
and Add-Ins button. Rename the button "Attach
Workgroup Templates," or something similarly
descriptive.


/ 162