In case you need the temp directory on a Windows machine in VBA, the following method might do the trick for you.

Source Code

It looks up the TMP or TEMP system environment variable.

1
2
3
4
5
6
7
8
9
10
11
12
13
' @Author - Alexander Bolte
' @ChangeDate - 2017-05-09
' @Description - Gets the path to a directory either available
' under the "TMP" or "TEMP" system environment variable.
' @Returns a String providing the directory registered in the users
' system under the corresponding environment variable.
Public Function getTempDirectory() As String
    Dim dirPath As String
    
    dirPath = IIf(Environ$("tmp") <> "", Environ$("tmp"), Environ$("temp"))
    
    getTempDirectory = dirPath
End Function