Visual Basic Language Reference  

ChDrive Function

Changes the current drive.

Public Overloads Sub ChDrive(ByVal Drive As { Char | String })

Parameter

Drive
Required. String expression that specifies an existing drive. If you supply 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.

Exceptions/Errors

Exception type Error number Condition
IOException 68 Invalid drive is specified, or drive is unavailable.

Example

This example uses the ChDrive function to change the current drive.

ChDrive("D")   ' Make "D" the current drive.

See Also

ChDir Function | CurDir Function | MkDir Function | RmDir Function | IOException