# ChDrive
{: .no_toc }

Changes the current drive.

Syntax: **ChDrive** *drive*

*drive*
: *required* A string expression that specifies an existing drive. If *drive* is a zero-length string (""), the current drive doesn't change. If the *drive* argument is a multiple-character string, **ChDrive** uses only the first letter.

### Common Errors

| Error | When |
|---|---|
| [-2147467259 (`&H80004005`)](/Reference/Run-time-Errors.md#-2147467259), *Unspecified error* | *drive* starts with a letter that no drive has<br>*drive* starts with a digit, a space or a punctuation character |
| [94 (`&H5E`)](/Reference/Run-time-Errors.md#94), *Invalid use of Null* | *drive* is **Null** |

> [!NOTE] BETA 1045
> When *drive* starts with a letter that no drive has, VB6 and 64-bit VBA raise error [68 (`&H44`)](/Reference/Run-time-Errors.md#68), *Device unavailable*, instead.

> [!NOTE] BETA 1045
> When *drive* starts with a digit, a space or a punctuation character, VB6 and 64-bit VBA raise error [5 (`&H5`)](/Reference/Run-time-Errors.md#5), *Invalid procedure call or argument*, instead.

### See Also

- [ChDir](/tB/Modules/FileSystem/ChDir.md), [MkDir](/tB/Modules/FileSystem/MkDir.md), and [RmDir](/tB/Modules/FileSystem/RmDir.md) statements
- [CurDir](/tB/Modules/FileSystem/CurDir.md) function

### Example

This example uses the **ChDrive** statement to change the current drive. 

```tb check_build
ChDrive "D"   ' Make "D" the current drive.
```