WD2000: How to Automatically Open the Last Document Edited

ID: Q214206


The information in this article applies to:
  • Microsoft Word 2000


SUMMARY

The bottom of the File menu lists the most recent files that you have saved or opened in chronological order (the last file that you saved or opened appears first). This list of files is commonly referred to as the "Most Recently Used (MRU)" list.

After you start Word, if you want to open the last file that you saved or opened, you can manually click the first file listed on the MRU list on the File menu. Or, you can have Word automatically open the file when you start Word by either modifying the Word command line or by creating an AutoExec macro.


MORE INFORMATION

To automatically open the last document that you edited when you start Word, use one of the following methods.

Method 1: Create a Shortcut Containing a Command-Line Switch

  1. Right-click the Windows desktop, point to New on the menu that appears, and then click Shortcut.


  2. In the Create Shortcut dialog box, click Browse.


  3. Change the Look in box to the following folder:


  4. C:\Program Files\Microsoft Office\Office
    NOTE: Your installation of Microsoft Word may be in a different location.

  5. Click Winword.exe, and then click Open.


  6. In the Command line box, move the insertion point to the end of the text after the closing quotation mark.


  7. Type a space followed by /mfile1.


  8. The command line should now appear similar to the following example:
    C:\Program Files\Microsoft Office\Winword.exe /mfile1
    NOTE: There is no space between the /m and file1.

  9. Click Next.


  10. In the Select a name for the shortcut box, type what you want to call this shortcut, and then click Finish.


Your new Word shortcut to start Word with the last edited file will now appear on the Windows desktop. When you double-click this shortcut, Word will start and automatically open the last file that you edited (changed).

Method 2: Use an AutoExec Macro

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp

For more information about using the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:
Q212536 OFF2000: How to Run Sample Code from Knowledge Base Articles
To create a macro that will automatically open the last file that you edited when you start Word, follow these steps:
  1. On the Tools menu, point to Macro, and then click Macros.


  2. In the Macros dialog box, type AutoExec in the Macro Name box, and then click Create.


  3. In the Microsoft Visual Basic (macro editing) window, type the following macro:


  4. 
    Sub Autoexec()
       RecentFiles(1).Open
    End Sub 
  5. On the File menu, click Close and Return to Microsoft Word.


  6. Quit Microsoft Word.

    NOTE: If you are prompted with the following message, click Yes.


  7. Changes have been made that affect the global template, Normal.dot. Do you want to save those changes?
When you restart Microsoft Word, Word will automatically open the last file you edited (changed).

Additional query words: switch start-up parameters arguments startup

Keywords : kbmacro kbdta wd2000
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbinfo


Last Reviewed: November 8, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.