ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting Default Save Path (https://www.excelbanter.com/excel-programming/366141-setting-default-save-path.html)

Corey

Setting Default Save Path
 
What code is there so that i can set the deafult save path to a network
address?
Would i place this in the WorkBook code ?
Regards
Corey....



Simon Lloyd[_818_]

Setting Default Save Path
 

I googled this!......it should help

Visual Studio Tools for the Microsoft Office System
How to: Get and Set the Default File Path for Workbooks

The DefaultFilePath property gets or sets the path that Microsoft
Office Excel 2003 uses for loading and saving files. You can display
the results in a named range.

Place the following code in the Sheet1.vb or Sheet1.cs file to display
the path for loading and saving Excel files. The code requires a
NamedRange control named defaultSavePath in a worksheet, where it
displays the path.

To display the default save path in a NamedRange control
Assign the default file path to the NamedRange control.

Visual Basic Copy CodeMe.defaultSavePath.Value2 =
Me.Application.DefaultFilePath

C# Copy Codethis.defaultSavePath.Value2 =
this.Application.DefaultFilePath;


You can set the default save path by assigning the path to the
DefaultFilePath property of the Application object.

To set the default save path by reading text from a NamedRange control
Assign the string value of defaultSavePath to the DefaultFilePath
property of the Application object.

Visual Basic Copy CodeMe.Application.DefaultFilePath =
Me.defaultSavePath.Value2.ToString()

C# Copy Codethis.Application.DefaultFilePath =
this.defaultSavePath.Value2.ToString();


Compiling the Code
This code requires a NamedRange control named defaultSavePath in a
worksheet.

This code must be placed in a sheet class, not in the ThisWorkbook
class.


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=557950



All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com