Results 1 to 2 of 2

Thread: For all you smart programmers out there

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Location
    W.Lafayette, In USA
    Posts
    37

    Cool

    The code below only works for windows nt computer and not a windows 95. Can anyone help me please!!

    Private Declare Function APICopyFile Lib "kernel32" Alias "CopyFileA" _
    (ByVal lpExistingFileName As String, _
    ByVal lpNewFileName As String, _
    ByVal bFailIfExists As Long) As Long

    Sub CopyFile(SourceFile As String, DestFile As String)

    Dim Result As Long

    If Dir(SourceFile) = "" Then
    MsgBox Chr(34) & SourceFile & Chr(34) & _
    " is not valid file name."
    Else
    Result = APICopyFile(SourceFile, DestFile, False)
    MsgBox "Result Code returned (0=file already exists, 1=file copy ok): " & Result
    End If

    private sub copy_click()
    Call CopyFile(App.Path & "\" & "EngineModelProject\16CM32HFO\16CM32HFOPartsCost(60).pdf", Caption & "\" & "16CM32HFOPartsCost(60).pdf")

    *The app.path is because that file is on a cd.

    On a windows 95 is gives me an error "that file is not a valid filename. But if that was the case then why does it works on windows nt.

    Thanks for any help
    Jay-B

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    This is a long shot, since I don't have a win 95 environment to test it with, but maybe if you try to add the vbReadOnly constant to the Dir function it could work. This because the files on a cd are read-only.
    eg
    If Dir(SourceFile, vbReadOnly) = "" Then

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