Hack 52 Control Word StartupThis 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 Start 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 Start 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.
You can use any of the startup switches from the
Start To create the new shortcut, right-click your desktop and choose
New Figure 6-3. Creating a customized Word startup shortcutThe 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.dot6.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.
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 |