ChDrive
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), Unspecified error | drive starts with a letter that no drive has drive starts with a digit, a space or a punctuation character |
94 (&H5E), Invalid use of Null | drive is Null |
Note BETA 1034
When drive starts with a letter that no drive has, VB6 and 64-bit VBA raise error 68 (&H44), Device unavailable, instead.
Note BETA 1034
When drive starts with a digit, a space or a punctuation character, VB6 and 64-bit VBA raise error 5 (&H5), Invalid procedure call or argument, instead.
See Also
Example
This example uses the ChDrive statement to change the current drive.
ChDrive "D" ' Make "D" the current drive.