Getting the Current Directory using API:   Return to List

Private Declare Function GetCurrentDirectory Lib "kernel32" Alias _
    "GetCurrentDirectoryA" (ByVal nBufferLength As Long, ByVal lpBuffer As _
    String) As Long

Private Sub Form_Load()
    Dim cwd As String
    Dim length As Long
    cwd = Space(128)
    length = GetCurrentDirectory(128, cwd)
    cwd = Left(cwd, length)
    MsgBox cwd
    End
End Sub



Note to Webmaster