Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default object.CopyFile() has an error?

Hi Robert,

Am Sat, 26 Dec 2015 03:16:34 -0700 schrieb Robert Crandal:

If you run the above code once, file1.txt will successfully
be copied into C:\data. However, run the code for a second
time and you get a run-time error 58 message that says:
"File already exists".
Why does this error message appear? I've set the overwrite
option to False, meaning do NOT overwrite.


VBA help says that you get this error if the file in the target exists
and overwrite = false
So you have to check if the file exists before running the code.

If I set the overwrite flag to True, the file inside C:\data
never gets overwritten. No matter how many times I try.
(Neither files are set to Read Only)


I had no problems to overwrite the file. True is default. Don't need to
write it:
fo.CopyFile "C:\file1.txt", "C:\Ordner1\file1.txt"
Do you have all the rights for "C:\" ?


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copyfile Paul Excel Programming 1 October 8th 09 11:06 AM
FileSystemObject.copyfile KR Excel Programming 7 June 9th 06 07:19 PM
Help using FileSystemObject CopyFile Tod Excel Programming 1 May 12th 04 10:18 PM
CopyFile usage Garry[_5_] Excel Programming 1 January 19th 04 08:56 PM
FileSystemObject CopyFile with UserID/Password Tod[_3_] Excel Programming 0 January 7th 04 06:03 PM


All times are GMT +1. The time now is 09:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"