0

I've been running this code for four months daily every two hours.

This morning I had a "permission denied" error. Once I had the user close the file, the VBA ran.

Is there a way to copy a file even though someone has it in use?

Public Sub SaveCL()
    Dim SourcePath As String
    Dim DestinationPath As String

    SourcePath = "\\CCX.ABC.com\Reporting\CL.xlsx"
    DestinationPath = "C:\Users\Public\Sources\CL1.xlsx"

    FileCopy SourcePath, DestinationPath

End Sub
Community
  • 1
  • 1
Amy Jones
  • 1
  • 6
  • Does this answer your question? [VBA to copy a file from one directory to another](https://stackoverflow.com/questions/16943003/vba-to-copy-a-file-from-one-directory-to-another) – BigBen Jan 14 '20 at 14:57

1 Answers1

0

I'll try the scripting method - saw comment in the link as follows: "Compared to the other, simple solution with FileCopy, this solution seems to have the advantage that the source file can also be copied while it is opened (e.g. by MS Access), i.e. when it's "read-only"." Thank you:)

Amy Jones
  • 1
  • 6