Results 1 to 3 of 3

Thread: Alternative FileCopy

  1. #1

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    If you try to use the FileCopy statement on a currently open file, an error occurs.

    Does anyone know how I can copy a file which may or may not be open?

    This must be possible because you can do it in Windows Explorer

    ------------------
    Mark Sreeves
    Analyst Programmer

    [email protected]
    A BMW Group Company

  2. #2
    Member
    Join Date
    Jan 1999
    Location
    Longmont,CO
    Posts
    53

    Post

    Use the objects provided by the Microsoft Scripting Runtime dll (FileSystemObject & File). Set a reference to Microsoft Scripting Runtime and try something like this:

    Dim f as FileSystemObject
    Dim fil as File

    'instantiate file system object
    Set f = New FileSystemObject

    'set file reference
    Set fil = f.GetFile(path)

    'copy the file
    fil.Copy(sDestination, Overwrite(True or False))


  3. #3

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    OK! OK! you can all stop looking now!
    The CopyFile API does the job

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