Link to home
Start Free TrialLog in
Avatar of upobDaPlaya
upobDaPlaya

asked on

Excel VBA FileCopy Permission Denied - Need a way to still copy the file

In Excel VBA I use the FileCopy statement to copy a file to another location.  However, how do I accomplish FileCopy if someone has the file open ?  My current FileCopy statement results in Permission Denied Error 70 if someone has the file open.

However, I noticed if the File is Open and I go to Windows explorer and I copy the file and then paste the file in any location I do not have any issue.

How can I accomplish FileCopy even if someone has the file open ?
ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of upobDaPlaya
upobDaPlaya

ASKER

Awesome !  But why does your solution work and file copy does not work if file open.
The FileCopy VBA statement is available as a simple method to copy a file. It uses a different method in the background from fso.CopyFile.
Thank you Wayne !