Results 1 to 2 of 2

Thread: Copy a file to temp with api

  1. #1

    Thread Starter
    Lively Member jonvantuyl's Avatar
    Join Date
    Nov 2000
    Location
    Michigan
    Posts
    75

    Cool

    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"

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    I think this line:

    FileCopy App.Path & "\page.html", "x=GetTemporaryFilename"

    should be:

    FileCopy App.Path & "\page.html", "GetTemporaryFilename"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width