Copy files in VBA

  • Thread starter Thread starter Isbjornen
  • Start date Start date
I

Isbjornen

Hello,

I need to use Access VBA to copy certain files (.pdf) when
some statements are true. The problem is that Access Help
is not very helpful. I found two methods, but no examples
on how to use them. Could anybody please help explain how
to use (write code) for Copy Method and/or CopyFile Method
(or if there is something better I can use, please let me
know).
As an example, I want to copy "MyFile.pdf"
from "C:\Windows" to "C:\My Documents"

Thanx,

Isbjornen
 
Isbjornen said:
Hello,

I need to use Access VBA to copy certain files (.pdf) when
some statements are true. The problem is that Access Help
is not very helpful. I found two methods, but no examples
on how to use them. Could anybody please help explain how
to use (write code) for Copy Method and/or CopyFile Method
(or if there is something better I can use, please let me
know).
As an example, I want to copy "MyFile.pdf"
from "C:\Windows" to "C:\My Documents"

FileCopy "C:\Windows\MyFile.pdf" "C:\My Documents\MyFile.pdf"
 
Hi,
Here's a sample from Help:

Dim SourceFile, DestinationFile
SourceFile = "SRCFILE" ' Define source file name.
DestinationFile = "DESTFILE" ' Define target file name.
FileCopy SourceFile, DestinationFile ' Copy source to target.
 
destination file is getting lost...

Hi guys,

I am using same code to overwrite a file but sometimes the destination files is getting lost...some how the code is deleting it.

Do you have any idea, what could be happening?

I appreciate your help
 
Back
Top