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

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

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

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

Andrew Savikas

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

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

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







Hack 52 Control Word Startup

This hack lets you start Word with your
favorite template or macro. It also shows you how to open Word with a
recent or specific document, suppress the Word splash screen, and do
away with the wretched default blank document.

Every day, in hundreds of
millions of homes and offices around
the world, Word starts the same way: a tired click of the Word item
on the Start menu, the brief irritation of the well-worn Word splash
screen (see Figure 6-2), and then the new blank
document based on Normal.dot that almost
everyone closes immediately because they need to either create a
document based on another template or work with an existing document.


Figure 6-2. "Will no one rid me of this turbulent splash screen?" Startup switch /q to the rescue!

Standardization can be wonderful, but even Microsoft realizes
it's not always efficient (let alone entertaining).
To make things better, you can control the Word startup via startup
switches. You can also augment this control over startup by using
AutoMacros [Hack #60] .


6.3.1 Startup Switches


Startup switches are special
commands you can provide when you
launch a program. For example, select StartRun and enter
the following to start Word normally:

winword

Word opens as if you launched it the usual way. But if you enter some
extra commands on the line, you can tell Word to start differently.
For example, select StartRun and enter the following:

winword /n

Word launches, but this time without the familiar blank document.
Some switches include additional information. If you enter the
following, Word will launch and create a new document based on the
"Contemporary Memo" template:

winword /t"Contemporary Memo"

Note that if the template or filename used with a switch contains
spaces, you need to enclose it in quotes.

Table 6-1 lists the startup switches you can use
with Word, in alphabetical order.

Table 6-1. Word startup switches

Startup switch


What it does


What to use it for


/a


Prevents the loading of all global templates (including
Normal.dot) and any add-ins. Prevents Word from
writing data to or reading data from the registry.


Troubleshooting problems with Word startup or instability; running
Word consistently in a student or lab environment.


/laddinpath


Loads the specified add-in or global template.


Loading an add-in or global template needed for a particular task but
not for normal running of Word.


/c


Launches a new Word session and then starts NetMeeting.


Seldom if ever useful.


/m


Prevents the AutoExec macro (if one exists) from
running.


Suppressing the running of your standard AutoExec
macro.


/mmacro


Runs the specified macro instead of running the
AutoExec macro (if one exists).


Setting up a Word session in a different way than usual (for example,
to perform a specific task) or running a VBA application hosted on
Word.


/mfilen


Opens the file specified by the number on the most recently used list.


Opening the last document or documents saved in the previous session;
occasionally useful.


/n


Launches a new Word session but does not create a new document based
on Normal.dot.


Suppressing the creation of a useless document; launching a second or
subsequent Word session.


pathname\filename


Opens the specified file or files after launching Word.


Consistently opening one or more files to work with.


/q


Suppresses the Word splash screen. Works only in some versions of
Word, including Word 2000 SR-1 and Word 2003.


Preventing the splash screen from appearing, which can be good for
VBA applications hosted on Word and for removing a widespread
irritant.


/r


Starts Word in the background, reregisters its registry settings, and
then closes Word.


Fixing registry problems. Be warned that although Word stays in the
background, the Windows installer appears in the foreground for most
versions of Word. Warn users before you use this switch.


/safe


Like /a, prevents the loading of all global
templates (includingNormal.dot) and any add-ins,
and prevents Word from writing data to or reading data from the
registry. In addition, does not create a new document; suppresses the
recovery of damaged documents and prevents the loading of smart tags,
toolbar customizations, and the AutoCorrect list. Works interactively
in Word XP and Word 2003.


Troubleshooting problems with Word startup or instability, especially
those caused by attempting to recover damaged documents.


/ttemplate


Creates a document from the specified template instead of creating a
document based on Normal.dot.


Starting Word and creating the type of document you need to use.


/w


Launches a new Word session and creates a new document based on
Normal.dot.


Creating multiple sessions of Word.


/x


Launches a new Word session from the operating shell, limited to
responding to one DDE request.


Seldom, if ever, useful. Use /w instead when you
need a new Word session.

You can use any of the startup switches from the
StartRun dialog. However, if you want to include a switch
every time Word starts, create a desktop shortcut. Every time you
double-click the shortcut, Word launches with the startup switch.

To create the new shortcut, right-click your desktop and choose
NewShortcut to launch the Shortcut Wizard. Click the Browse
button, navigate to WINWORD.EXE (for Office
2003, that's in C:\Program Files\Microsoft
Office\OFFICE11), and click the OK button. The Shortcut
Wizard fills in the full path. At the end of the path, include the
switch /n, as shown in Figure 6-3, and then click the Next button.


Figure 6-3. Creating a customized Word startup shortcut

The wizard asks you to name your new shortcut. Name it
"Word No Blank," or something
similar. The shortcut is placed on your desktop. Now whenever you
want to launch Word without creating a blank document, just
double-click this shortcut. You can create additional shortcuts using
other switches, making it easy to launch Word in a variety of ways,
depending on the task at hand.

From the descriptions in Table 6-1, you can see
that there are three main themes to startup switches: troubleshooting
startup problems, launching further Word sessions, and opening the
files you need. Let's take a closer look at how to
use the more useful switches.

6.3.1.1 Troubleshooting problems


If you have Word 2002 or Word 2003, use the /safe
switch to recover from Word crashing on startup. If Word still will
not run with several of the leading potential sources of instability
[Hack #51]
eliminated, use the /r switch to register Word. If
even this does no good, you may need to reinstall Word.

6.3.1.2 Running further sessions of Word


One Word session at a time is enough for most mortals. After all, you
can open
dozens of documents, each in its own window, in one session. But
sometimes you need another Word session for testing or for performing
special tasks.

The switches /n and /w will
start a new instance of Word, but remember that
Normal.dot acts as a choke point for saving any
modifications you might make in a second or subsequent session of
Word. If you save changes to Normal.dot in one
session, it will overwrite any changes saved to
Normal.dot from previous sessions.

Usually, this problem emerges when you exit each session in turn, and
the second or subsequent session warns you that
Normal.dot already exists and asks if you want
to replace it (see Figure 6-4). Click the Yes
button to replace Normal.dot, click the Cancel
button to return to the Word session, or click the No button to save
this version of Normal.dot under a different
name or in a different folder (you can then manually integrate the
changes to this version of Normal.dot with the
changes to the other versions laterif you can remember the
changes you made).


Figure 6-4. When you run multiple Word sessions, you may get into situations where you've changed two or more copies of Normal.dot and cannot easily save changes without overwriting the current Normal.dot

6.3.1.3 Opening one or more files


Perhaps the most popular use of startup switches is to quickly open
the documents you need. You can use the
/mfilen switch to open
one of the files on the most recently used (MRU) list [Hack #13] . The
pathname\filename
switch is even more useful because it lets you specify any files you
want. To open multiple files, put a space between the names:

winword "z:\public\Strategic Plan.doc" c:\private\my_subversive_novel.doc

Again, note that if the filename or pathname includes a space,
you'll need to put quotes around the entire name.


6.3.2 Hacking the Hack


You can use the startup switch /m to run a macro
and gain full control over a Word session you launch. You can use
this switch to do anything from running a custom application (for
example, one that gathers user input through user forms, executes a
task, and then quits) to simply setting up the Word window for quick
work.


In theory, you can use the /t switch together with
the /m switch to run a macro in a new document
based on a specific template. However, it works much better if you
store the macro in Normal.dot and then use the
/m switch to run the macro on startup.

The following short macro automatically opens a document in two
windows: one window for editing in full-screen Print Preview, and the
other window showing an outline at Level 3. It also minimizes the
second window to keep it out of the way until you need it.

Sub Set_Up_Word_Window( )
' Opens another window, applies Outline view, and minimizes it
' Applies Print Preview and editing view to the main window
With ActiveWindow
.NewWindow
Windows(1).Activate
.WindowState = wdWindowStateNormal
.Left = 0
.View = wdOutlineView
.View.ShowHeading 3
.Caption = "Outline View"
Windows(2).Activate
Windows(1).WindowState = wdWindowStateMinimize
End With
ActiveDocument.PrintPreview
CommandBars("Print Preview").Visible = False
With ActiveWindow
.View.Magnifier = False
.DisplayHorizontalScrollBar = False
.WindowState = wdWindowStateMaximize
.Caption = "Editing View"
End With
End Sub

To run the macro, specify the document to open and then use the
/m switch with the macro name:

winword "D:\Projects\Pergelisol Tragedy.doc" /mSet_Up_Word_Window

This method has one big advantage: it lets you run the macro
selectively. If you used an AutoMacro [Hack #60]
instead, the macro would run every time you started Word.

Guy Hart-Davis


/ 162