This API and some others (GetUserName) do not return the value that you're after, but rather, populate a parameter by reference with the appropriate information, provided that it can.
First declare the function prototype in a module
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
The in your code, declare and initialize the parameter to accept the returning information.
Dim lStr_TempPath as String
' Initialize the buffer to all nulls, with a max length of 254 chars
lStr_TempPath = String (254, chr(0))
' Call the API with the appropriate parameters note the match in length
GetTempPath 254, lStr_TempPath
' Since C null terminates strings, but VB does not, we need to remove the balance of the trailing nulls
lStr_TempPath = left(lStr_TempPath, InStr(lStr_TempPath, chr(0)) - 1) Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein