Option Explicit
Private Declare Function GetLongPathName Lib "kernel32" Alias "GetLongPathNameA" (ByVal lpszShortPath As String, ByVal lpszLongPath As String, ByVal cchBuffer As Long) As Long
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Sub GetTEMPfolder(Optional ByVal showlong As Boolean = True)
Private Sub WinntPathsub()
Dim Filesys As New FileSystemObject
Dim File As File
WinntPath = Filesys.GetSpecialFolder(0)
WinntName = Left(Filesys.GetSpecialFolder(0), 1)
WinntTemp = Filesys.GetSpecialFolder(2)
End Sub
Option Explicit
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Function GetTEMPfolder() As String
Dim Str As String * 255
GetTempPath Len(Str) + 1, Str
GetTEMPfolder = Left$(Str, InStr(Str, Chr$(0)) - 2)
End Function
Private Sub Command1_Click()
MsgBox GetTEMPfolder
End Sub