-
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
-
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))
-
OK! OK! you can all stop looking now!
The CopyFile API does the job