This should do itCode:Declare Function SHGetSpecialFolderPath Lib "shell32.dll" Alias "SHGetSpecialFolderPathA" (ByVal hwndOwner As Long, ByVal lpszPath As String, ByVal nFolder As Long, ByVal fCreate As Long) As Long Const CSIDL_SYSTEM = &H25 Function GetSystemDir() As String ' Display the path of the directory used as the System ' special folder. Dim pathname As String ' receives the path of System DDim retval As Long ' return value ' Make enough room in the buffer to receive the string. pathname = Space(260) ' Get the path name of the My Documents special folder retval = SHGetSpecialFolderPath(Form1.hWnd, pathname, CSIDL_SYSTEM, 0) ' Remove the empty space from the string. pathname = Left(pathname, InStr(pathname, vbNullChar) - 1) ' Display the result. GetSystemDir = pathname




Reply With Quote