HOW TO:取得及設定活頁簿的預設檔案路徑
下列範例示範如何取得及設定 Microsoft Office Excel 用來載入和儲存檔案的預設路徑。
**適用於:**本主題中的資訊適用於 Excel 2007 和 Excel 2010 的文件層級專案和應用程式層級專案。如需詳細資訊,請參閱依 Office 應用程式和專案類型提供的功能。
若要取得預設儲存路徑
請使用 _Application 物件的 DefaultFilePath 屬性,取得預設路徑。
System.Windows.Forms.MessageBox.Show(Me.Application.DefaultFilePath)
System.Windows.Forms.MessageBox.Show(this.Application.DefaultFilePath);
若要設定預設儲存路徑
將字串值指派給 Application 物件的 DefaultFilePath 屬性。
Me.Application.DefaultFilePath = "C:\temp"
this.Application.DefaultFilePath = @"C:\temp";