Downloads
47900.zip

My company currently uses Microsoft Office XP. I've pinned shortcuts to winword.exe and excel.exe on the Start menu, then renamed those shortcuts Word 2002 and Excel 2002, respectively. We're in the process of upgrading to Microsoft Office 2003. The upgrade removes the old Office components but doesn't remove the items pinned to the Start menu. I know there's a script method to pin a file to the Start menu, but what I want is a script that will remove the old pinned items from the Start menu, install Office 2003, then pin new Office 2003 Word and Excel shortcuts to the Start menu. Any suggestions?

For those unfamiliar with the term, pinning an item to the Start menu is a Windows XP feature that lets you make a program permanently appear above the Start button (rather than letting the program appear or disappear depending on usage). In a nutshell, pinning or unpinning a shortcut from a script involves the following steps:

  1. Create a Shell.Application object.
  2. Use the object's NameSpace method, with the directory containing the shortcut (.lnk) file as an argument, to return a Folder object. (Note that this Folder object is different from the Scripting.FileSystemObject's Folder object.)
  3. Use the Folder object's ParseName method, with the filename to pin as an argument, to return a FolderItem object. If you're pinning a shortcut, you must include the .lnk extension.
  4. Use the FolderItem object's InvokeVerb method with the appropriate string argument—in this case, "Unp&in from Start menu" or "P&in to Start menu" (the & character is part of the verb string and is required).

As you're aware, when you pin a shortcut to the Start menu and later delete that shortcut, the pinned item isn't automatically removed from the Start menu. Therefore, I recommend unpinning the existing shortcuts before you do anything else. Listing 2 shows a sample script, UnpinWord.vbs, that unpins Word 2003 from the Start menu. First, the script uses the WshShell object's Environment object to determine which directory contains the Office 2003 shortcuts. Then, it uses the four-step process I mentioned earlier to unpin the shortcut, as callout A in Listing 2 shows. You can modify this script to unpin the Word and Excel shortcuts for your Office XP installation.

When you upgrade to Office 2003, I recommend that you use the Office 2003 Custom Installation Wizard (CIW), which you can find in the Office 2003 Resource Kit (ORK—http://www.microsoft.com/office/orkarchive/2003ddl.htm), to customize your installation. The CIW lets you add shortcuts, named whatever you like, to the default Office 2003 installation. After installing Office, you can use a script to pin the required shortcuts to the Start menu. Listing 3 shows a sample script, PinFromDesktop.vbs, that pins a Word shortcut found on the desktop.