Search notes:

Examples for Visual Basic for Application accessing the Windows API: GetTempPath

The Windows API function GetTempPath returns the name of the temporary directory.
The following example needs the VBA declarations of the Windows API which can be found here.
option explicit

sub main()

   dim tempPath as string * 512
   dim result   as long

   result = GetTempPath(512, tempPath)

   if result <> 0 then
      msgBox "Temp path: " & tempPath
   else
      msgBox "Calling GetTempPath failed"
   end if

end sub

Github repository WinAPI-4-VBA, path: /examples/GetTempPath.bas

See also

GetTempFileName
Other examples

Index