Tempフォルダを取得する

 


Option Explicit

' Tempフォルダ取得用
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" _
(ByVal nBufferLength As Long, _
ByVal lpBuffer As String) As Long


Private Sub Command1_Click()
Dim strTempPathName As String * 516
Dim lngWin32apiResultCode As Long
Dim strGetPath As String 'パス取得結果

' Tempフォルダを取得
lngWin32apiResultCode = GetTempPath(Len(strTempPathName), strTempPathName)
' 取得フォルダ名より不要スペースを削除する
strGetPath = Left(strTempPathName, InStr(strTempPathName, vbNullChar) - 1)


End Sub


トップページに戻る

Tips一覧に戻る