CurDir Function

Mengembalikan varian string yang mewakili jalur saat ini dari drive yang ditentukan.

Ikon Peringatan

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


Sintaksis:

CurDir [(Teks As String)]

Nilai hasil:

String

Parameter:

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.

Fungsi ini tidak bergantung huruf besar/kecil.

Kode kesalahan:

5 Tidak sah dalam pemanggilan prosedur

68 Perangkat tidak tersedia

7 Kehabisan memori

51 Kesalahan internal

Contoh:

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