Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Runtime Error '53' File Not Found?

Hi,

I have an Excel macro that is supposed to go through all the files in a
directory and change the extensions from DOC to DAT. It was working at
first, but now it seems that I keep getting the File Not Found error (Runtime
Error 53) when I try to run the macro, even though the file to be renamed is
explicitly there in the folder.

What am I missing here?

Thanks in advance!

Public Sub ChangeFileExtensions()
Dim strDir As String

strDir = ThisWorkbook.Path

Call ProcessFiles(Dir(strDir & "\*.Doc"))

Do ' LOOP THRU ALL D06 IN JUNKFOLDER
Loop Until Not ProcessFiles(Dir)

End Sub

Function ProcessFiles(SourceFile)
On Error GoTo NoFiles
oldName = SourceFile
newName = Left(SourceFile, (Len(SourceFile) - 3)) & "DAT"

Name oldName As newName

Exit Function
NoFiles:
ProcessFiles = False


End Function

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
Retaining formats grok Excel Discussion (Misc queries) 11 October 31st 06 07:29 PM
file not found when opening the file bribri Excel Discussion (Misc queries) 2 September 1st 06 11:00 PM
File Not Found between two versions Brian G Excel Discussion (Misc queries) 3 June 22nd 06 06:58 PM
Weird File Open/Save As Behavior [email protected] Excel Discussion (Misc queries) 0 December 9th 05 02:26 AM
Weekly Transaction Processing Ralph Howarth Excel Worksheet Functions 4 January 19th 05 05:37 AM


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

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

About Us

"It's about Microsoft Excel"