Excel

Find temporary folder

Ease of Use

Easy

Version tested with

97 

Submitted by:

Paleo

Description:

This macro shows you where is your windows temporary folder 

Discussion:

Sometimes, during windows configuration users move their temporary folders and you need to find it during a project. This macro shows you where it is. 

Code:

instructions for use

			

Declare Function GetTempPath _ Lib "kernel32" Alias "GetTempPathA" _ (ByVal nBufferLength As Long, _ ByVal lpBuffer As String) As Long Public Function fncGetTempPath() As String Dim PathLen As Long Dim WinTempDir As String Dim BufferLength As Long BufferLength = 260 WinTempDir = Space(BufferLength) PathLen = GetTempPath(BufferLength, WinTempDir) If Not PathLen = 0 Then fncGetTempPath = Left(WinTempDir, PathLen) Else fncGetTempPath = CurDir() End If End Function Sub Test() MsgBox fncGetTempPath End Sub

How to use:

  1. Create a command button (cmdStart) for starting the counter, in the Main sheet
  2. Goto Excel --> Tools --> Macro --> Visual Basic Editor (Or Press Alt + F11)
  3. In VBE window, goto Insert --> Module
  4. Double Click the Module1 and paste the code shown above.
 

Test the code:

  1. Click the Start button.
 

Sample File:

TempFolder.zip 13.25KB 

Approved by Jacob Hilderbrand


This entry has been viewed 134 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express