Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Macro to move files gets an error if it already exists...

It causes an error (53 path not found) for me.

Marco Pagliero wrote:

On 5 Mrz., 20:00, JLatham <HelpFrom @ Jlathamsite.com.(removethis)
wrote:
Or you could simply use
KILL NewFilePath
since you've already set that up in your code. Got in too big of a rush to
copy. So

Function TXTFileMove()

OldFilePath = "C:\Import Files\New\" & TXTFileName
NewFilePath = C"\Import Files\Complete\" & TXTFileName
On Error Resume Next
KILL NewFilePath
If ERR<0 Then
ERR.CLEAR
End If
On Error Goto 0
Name OldFilePath As NewFilePath

End Function

KILL doesn't generate an error if the file doesen't exist, KILL
generates an error only if the file is open. So maybe "on error resume
next" and the rest are not necessary after all.

Greetings
Marco P


--

Dave Peterson
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
Error with linked files....Macro Problem??? masterbaker Excel Worksheet Functions 1 July 28th 06 08:23 PM
Move data Macro kingcole Excel Discussion (Misc queries) 2 July 10th 06 02:47 PM
remove error value when formula exists for empty cells Cyrus Excel Worksheet Functions 2 February 17th 06 04:19 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
How do I move files that are linked with template wizard? most xlent Excel Discussion (Misc queries) 0 March 21st 05 05:37 PM


All times are GMT +1. The time now is 09:56 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"