This Blog

Syndication

Search

Tags

News

Community

Email Notifications

Archives

Grupos de Usuários

Blogs MVPs Brasil

Sites

Determinando onde está a pasta de arquivos temporários do Windows

Você já desejou identificar onde está a pasta de arquivos temporários do Windows através de sua planilha?

Coloque o seguinte código em um módulo e execute ele:

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

Published Wed, Apr 6 2011 10:28 by paleo
Filed under:

Comments

# re: Determinando onde está a pasta de arquivos temporários do Windows@ Wednesday, April 06, 2011 12:57 PM

Não entendi!

Como faço para executar, que módulo é esse..

Explique melhor

No aguardo

by rafael

# re: Determinando onde está a pasta de arquivos temporários do Windows@ Wednesday, April 06, 2011 2:24 PM

já descobri

by rafael

# re: Determinando onde está a pasta de arquivos temporários do Windows@ Wednesday, April 06, 2011 2:25 PM

agora descobri

by rafael