ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FileCopy (https://www.excelbanter.com/excel-programming/273544-re-filecopy.html)

John Green[_2_]

FileCopy
 
Don,

You are right. You could use something like the following to preeventoverwriting an existng file:

If Dir("C:\Data.xls") = "" Then
FileCopy "C:\MyFiles\Data.xls", "C:\Data.xls"
Else
MsgBox "File already exists"
End If


--

John Green - Excel MVP
Sydney
Australia


"Donald Lloyd" wrote in message ...
Hi,

I'm looking at using the FileCopy function to copy a file(s) from one drive
to another.
Am I right in observing that this function will overwrite a File without
warning ?

Regards,
Don

--






Donald Lloyd

FileCopy
 
Thank you John


very helpful.

Don

--

"John Green" wrote in message
...
Don,

You are right. You could use something like the following to

preeventoverwriting an existng file:

If Dir("C:\Data.xls") = "" Then
FileCopy "C:\MyFiles\Data.xls", "C:\Data.xls"
Else
MsgBox "File already exists"
End If


--

John Green - Excel MVP
Sydney
Australia


"Donald Lloyd" wrote in message

...
Hi,

I'm looking at using the FileCopy function to copy a file(s) from one

drive
to another.
Am I right in observing that this function will overwrite a File without
warning ?

Regards,
Don

--









All times are GMT +1. The time now is 10:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com