VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Create a Temporary file.

by Murali (2 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 29th June 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Create a Temporary file.

Rate Create a Temporary file.



Option Explicit
'Creates Temp File
'Add a Command button..command1
'Add a Text box
'Copy and paste the following code.
'====COMMENT END==============


Private Function GetTempName(TmpFilePrefix As String) As String
    Dim TempFileName As String * 256
    Dim X As Long
    Dim DriveName As String
    DriveName = "c:\"
    X = GetTempFileName(DriveName, TmpFilePrefix, 0, TempFileName)
    GetTempName = Left$(TempFileName, InStr(TempFileName, Chr(0)) - 1)
End Function
Private Sub Command1_Click()
    Dim FilePrefix As String
    Dim NewFile As String * 256
    FilePrefix = "TEST"
    NewFile = GetTempName(FilePrefix)
    Text1.Text = NewFile
End Sub

Download this snippet    Add to My Saved Code

Create a Temporary file. Comments

No comments have been posted about Create a Temporary file.. Why not be the first to post a comment about Create a Temporary file..

Post your comment

Subject:
Message:
0/1000 characters