Copy a protected file else where - FileCopy Statement

M

Michael

Hello,

I tried to use the FileCopy Statement to copy a file located in a read only
folder to an other folder that has no restriction. But it did not work and I
get an error message . Is there a way to do it in VB?
(It is for a MS Access 2000 Application)

Doing it manualy: Copy of files from the read only folder and paste to a
folder that has no restriction works in Windows Explorer. But I'm looking to
do it in VB from a command button...

Thanks,
 
A

Alex Dybenko

Perhaps file is opened, then try to use API function:

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

call apiCopyFile(strSource, strTarget, boolFailIfExists)
 
Top