VBA ChDrive function

ChDrive function Description

The VBA ChDrive function changes the current drive. The ChDrive function does not change however the current directory – scroll down to learn more.

Syntax

The syntax for the ChDrive function is:

ChDrive( drive )

Parameters

drive
The drive that you wish to change to.

Other Note

The ChDrive function changes only the current drive. Use the ChDir function to change the current directory.

Example usage

The ChDrive statement can be used in VBA. Let’s look at some ChDrive function examples:

ChDrive "C"
Result: Drive changed to C

ChDrive "D"
Result: Drive changed to D