Description
The Microsoft Excel CHDIR statement allows you to change the current directory or folder.
Syntax
The syntax for the CHDIR statement in Microsoft Excel is:
ChDir path
Parameters or Arguments
- path
- The path that you'd like to set the current directory to.
Note
- The CHDIR statement lets you change the current directory on the current drive. If you need to change drives, try using the CHDRIVE statement first.
Applies To
- Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Function
- VBA function (VBA)
Example (as VBA Function)
The CHDIR statement can be used in VBA code in Microsoft Excel.
Let's look at some Excel CHDIR statement function examples and explore how to use the CHDIR statement in Excel VBA code:
ChDir "C:\instructions"
Result: Sets the current directory to C:\instructions
ChDir "C:\Documents\Supplies"
Result: Sets the current directory to C:\Documents\Supplies
For example:
ChDir "C:\instructions"
In this example, the current directory would now be changed to C:\instructions.
No comments:
Post a Comment