CurDir Function

рд╡реЗрд░рд┐рдПрдВрдЯ рд╕реНрдЯреНрд░рд┐рдВрдЧ рдкреНрд░рд╕реНрддреБрдд рдХрд░рддрд╛ рд╣реИ рдЬреЛ рдирд┐рд░реНрдзрд╛рд░рд┐рдд рдбреНрд░рд╛рдЗрд╡ рдХреЗ рдореМрдЬреВрджрд╛ рдкрде рдХрд╛ рдкреНрд░рддрд┐рдирд┐рдзрд┐рддреНрд╡ рдХрд░рддрд╛ рд╣реИ.

Warning Icon

This statement currently does not work as documented. See this issue for more information.


Syntax:


ChDir Text As String

рд╡рд╛рдкрд╕реА рдореВрд▓реНрдп:

рд╡рд╛рдХреНрдпрд╛рдВрд╢

рдкреИрд░рд╛рдореАрдЯрд░

Text: Any string expression that specifies an existing drive (for example, "C" for the first partition of the first hard drive).

If no drive is specified or if the drive is a zero-length string (""), CurDir returns the path for the current drive. LibreOffice Basic reports an error if the syntax of the drive description is incorrect, the drive does not exist, or if the drive letter occurs after the letter defined in the CONFIG.SYS with the Lastdrive statement.

рдпрд╣ рдлрд╝рдВрдХреНрд╢рди рдХреЗрд╕-рд╕реЗрдВрд╕рд┐рдЯрд┐рд╡ рдирд╣реАрдВ рд╣реИ.

Error codes:

5 Invalid procedure call

68 Device not available

7 Not enough memory

51 Internal error

рдЙрджрд╛рд╣рд░рдг:


Sub ExampleCurDir
Dim sDir1 As String , sDir2 As String
    sDir1 = "c:\Test"
    sDir2 = "d:\Private"
    ChDir( sDir1 )
    MsgBox CurDir
    ChDir( sDir2 )
    MsgBox CurDir
End Sub