[AccessD] Windows Temporary Directory

Dale Kalsow dkalsow at yahoo.com
Tue Aug 16 07:39:19 CDT 2011


OK - thanks,  One question how and is MAX_PATH defined?
 
Dale

From: Stuart McLachlan <stuart at lexacorp.com.pg>
To: Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Sent: Monday, August 15, 2011 4:16 PM
Subject: Re: [AccessD] Windows Temporary Directory

I put this in a Public module:

<code>
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" _
(ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long

Public Function TempDir() As String
Dim strPath As String
strPath = Space(MAX_PATH)
GetTempPath Len(strPath), strPath
  TempDir = Left(strPath, InStr(1, strPath, vbNullChar) - 1)
End Function
</code>

and then use it like this:

<code>
'build full path/file name and delimit with qiuotes to
'allow for spaces in path of file

strQ = chr$(34)
strFile = "myfile.txt"
strFile = strQ & Tempdir()  & strFile & strQ

'Now open file from a Shell
strShell = "Notepad.exe " &  & strFile
retval = Shell(strShell)
</code>

-- 
Stuart
On 15 Aug 2011 at 8:07, Dale Kalsow wrote:

> Good Morning,
>  
> I am trying to write a file into the windows temporary directory but
> am having issues referencing it.  Could someone tell me the propery
> way to reference the temp direcory when using the RetVal = Shell()
> command.   Thanks!   Dale -- AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd Website:
> http://www.databaseadvisors.com
> 




-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list