How to: Get and Set the Default File Path for Workbooks

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

  • Application-level projects

Microsoft Office version

  • Excel 2003

  • Excel 2007

For more information, see Features Available by Application and Project Type.

The following examples show you how to get and set the default path that Microsoft Office Excel uses for loading and saving files.

To get the default save path

  • Use the DefaultFilePath property of the _Application object to get the default path.


To set the default save path

  • Assign a string value to the DefaultFilePath property of the Application object.

    Me.Application.DefaultFilePath = "C:\temp"
    this.Application.DefaultFilePath = @"C:\temp";

See Also


How to: Read from and Write to Document Properties


Working with Workbooks

NamedRange Control