Microsoft KB Archive/175026

= PRJ98: How to Change the Default Working Directory =

Article ID: 175026

Article Last Modified on 1/20/2007

-

APPLIES TO


 * Microsoft Project 98 Standard Edition

-



This article was previously published under Q175026



IMPORTANT: This article contains information about editing the registry. Before you edit the registry, make sure you understand how to restore it if a problem occurs. For information about how to do this, view the "Restoring the Registry" Help topic in Regedit.exe or the "Restoring a Registry Key" Help topic in Regedt32.exe.



SUMMARY
This article describes how to change the default directory that Microsoft Project 98 uses when you open and save files.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements. Use either of the following two methods to change the default directory that Microsoft Project uses when you open and save files.

Method 1: Create a Macro
 In Microsoft Project, on the Tools menu, point to Macro, then Visual Basic Editor. In the Project Explorer, expand ProjectGlobal (Global.mpt) Expand Microsoft Project Objects. Double click ThisProject (Global.mpt). In the Code window, in the Object drop down, click Project.  Between the following lines: Private Sub Project_Open(ByVal pj As MSProject.Project) End Sub add this line: Auto_Open </li> On the Insert menu, click Procedure.</li> In the Name: box, type Auto_Open.</li> In Type, click Sub.</li> In Scope, click Public. Click OK.</li>  Between the following lines: Public Sub Auto_Open

End Sub add this line: ChDrive "c:\" ChDir "c:\My Documents" NOTE: c:\My Documents is the new default directory for Project. It can be replaced with an alternate folder name. Note that the drive specified for ChDrive must match the drive specified for ChDir. </li> On the File menu, click Save Global.mpt.</li> On the File menu, click Close and Return to Microsoft Project.</li> In Microsoft Project, on the File menu, click Exit.

Each time Microsoft Project is started, the default directory will be changed to the location specified in the macro.</li></ol>

Method 2: Modify the Windows Default Directory in the Registry
WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

For information about how to edit the registry, view the "Changing Keys And Values" Help topic in Registry Editor (Regedit.exe) or the "Add and Delete Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe. Note that you should back up the registry before you edit it.

NOTE: The following steps change the default working directory in Microsoft Windows. Microsoft Access, Microsoft Excel, Microsoft Power Point, and Microsoft Word allow you to use default directories other than the Windows default directory.

To set the default working directory, follow these steps:


 * 1) On the Windows Start menu, click Run.
 * 2) In the Open box, type "regedit" (without the quotation marks). Click OK.
 * 3) In the Registry Editor, select the following registry key: HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\ Explorer\ User Shell Folders
 * 4) In the right pane, double-click Personal.
 * 5) In the Value Data box, type the path you want to use for the default working directory. For example, type "C:\My Documents" (without the quotation marks).
 * 6) Click OK.
 * 7) On the Registry menu, click Exit.

Additional query words: folder

Keywords: kbdtacode kbfaq kbhowto kbprogramming KB175026

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.