CURDIR

CURDIR[(drive)]

Returns the current path of a given drive (Variant / String).


drive(Optional) The existing drive (String).

REMARKS
* If "drive" = "", then the current drive is returned.
* If "drive" is not a currently mapped drive, then you will get a run time error.
* If "drive" is left blank, then the current drive is returned.
* You can use the CHDIR statement to define the current default directory.
* You can use the CHDRIVE statement to define the current default drive.
* You can use the CURDIR$ function to return a String data type instead of a Variant data type.
* You can use the DIR function to check if a file or directory exists.
* The equivalent .NET function is Microsoft.VisualBasic.FileSystem.CurDir
* For the Microsoft documentation refer to learn.microsoft.com

Dim sDirectory As String 

ChDir("C:\")
sDirectory = CurDir("C")
Debug.Print sDirectory '= "C:\"

ChDir("C:\users\public")
sDirectory = CurDir()
Debug.Print sDirectory '= "C:\users\public"

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top