jonvantuyl
Nov 26th, 2000, 08:17 PM
i need to copy a HTML page from the Apps Path to the temp directory but it needs to have its own name. So i used the code below to do it and it doesnt seem to work, does anybody know whats wrong with it or another way to do it?
MOD CODE:
Public Declare Function GetTempFilename Lib "kernel32" Alias _
"GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString _
As String, ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
Public Declare Function GetTempPath Lib "kernel32" Alias _
"GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer _
As String) As Long
Public Function GetTemporaryFilename(Optional Prefix _
As String = "") As String
On Error GoTo TempNameErr
Dim lngReturnVal As Long
Dim strTempPath As String * 255
Dim strTempFilename As String * 255
lngReturnVal = GetTempPath(254, strTempPath)
lngReturnVal = GetTempFilename(strTempPath _
& "\", Prefix, 0, strTempFilename)
GetTemporaryFilename = strTempFilename
Exit Function
TempNameErr:
'Enter any error handling here.
MsgBox "Cannot retrieve temporary filename - " & _
Err.Description
End Function
COMMAND BUTTON CODE:
FileCopy App.Path & "\page.html", "x=GetTemporaryFilename"
MOD CODE:
Public Declare Function GetTempFilename Lib "kernel32" Alias _
"GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString _
As String, ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
Public Declare Function GetTempPath Lib "kernel32" Alias _
"GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer _
As String) As Long
Public Function GetTemporaryFilename(Optional Prefix _
As String = "") As String
On Error GoTo TempNameErr
Dim lngReturnVal As Long
Dim strTempPath As String * 255
Dim strTempFilename As String * 255
lngReturnVal = GetTempPath(254, strTempPath)
lngReturnVal = GetTempFilename(strTempPath _
& "\", Prefix, 0, strTempFilename)
GetTemporaryFilename = strTempFilename
Exit Function
TempNameErr:
'Enter any error handling here.
MsgBox "Cannot retrieve temporary filename - " & _
Err.Description
End Function
COMMAND BUTTON CODE:
FileCopy App.Path & "\page.html", "x=GetTemporaryFilename"