PDA

View Full Version : Copy an access PDF report from desktop to a folder



dwinn86
11-24-2011, 02:49 AM
Hi everyone,

I am having a spot of bother...

I have produced code in access to print a report I have in access and save it to my desktop. I then want to copy that file and move it to another folder that is on my desktop.

For a test to prove it works, I have produced code in access to copy a file from my desktop to another folder.

When I run this code...nothing happens.

Here is my code:


Sub Testing()
Dim strCmd As String
strCmd = " copy ""C:\Desktop\Hello.pdf"" ""C:\Desktop\Folder\Hello.pdf"""

Debug.Print strCmd
ExecCmd strCmd
Debug.Print "Process Finished"
End Sub


I was wondering if someone could pin point what I am doing wrong and what I should have in there if possible?

Many thanks,

Dan

orange
11-24-2011, 06:45 AM
VBA has a command FileCopy to do what you want.

in vba....
dim strSourceFile as String
dim strDestinationFile as String


FileCopy strSourceFile, strDestinationFile