Run-time error 70

almagg

Well-known Member
Joined
Aug 21, 2002
Messages
705
i want to make a copy of a file to a new folder.
but i get a "Permission denied" error.

(1)
FileCopy sFolder & "Site Safety Metrics Rollup.xlsm", _
sNewFolder & "Site Safety Metrics Rollup.xlsm"

this also gives an error:
(2)
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")

fs.CopyFile sFolder & "Site Safety Metrics Rollup.xlsm", sNewFolder & "Site Safety Metrics Rollup.xlsm"

but this works(after adding the library)
(3)
Dim FSObj As FileSystemObject
Set FSObj = New FileSystemObject

FSObj.CopyFile sFolder & "Site Safety Metrics Rollup.xlsm", _
sNewFolder & "Site Safety Metrics Rollup.xlsm", True

can i do anything in order to use (1)?
just because i am also 'moving' files which also deletes the old file
and there is just the one file that i wanty to 'copy' without deleting.

Name sFolder & "TFP EHS Metrics Presentation.potx" _
As sNewFolder & "TFP EHS Metrics Presentation.potx"


hmmm, maybe just do a "SaveAs" to the new folder.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Maybe its a permisson with dos commands or writing to the folder.

I would go the path of save as. if that fails then look at read/write permissons on both folders
 
Upvote 0
i am contracting and working on a company laptop.
so probably has to do with 'administrative' rights.
i am going to go with the 'save as'.
thanks.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top