ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Test if "FileCopy" function fails (https://www.excelbanter.com/excel-programming/437808-test-if-filecopy-function-fails.html)

Robert Crandal

Test if "FileCopy" function fails
 
I am using the following line to copy a file:

FileCopy file1, file2

How can I test if the above function call fails
or not?? I tried using the following code below,
but I received a compiler error:

Set fc = FileCopy file1, file2

if fc is Nothing then
' it failed
else
' it worked
end if


Thank you!





Harald Staff[_2_]

Test if "FileCopy" function fails
 
Hi

Test if file2 exists, alternatively also if its filesize is identical to
file1.

HTH. Best wishes Harald

"Robert Crandal" wrote in message
...
I am using the following line to copy a file:

FileCopy file1, file2

How can I test if the above function call fails
or not?? I tried using the following code below,
but I received a compiler error:

Set fc = FileCopy file1, file2

if fc is Nothing then
' it failed
else
' it worked
end if


Thank you!







All times are GMT +1. The time now is 07:12 AM.

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