View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Change file names in a folder

Hi TISR

Post a few of your file names in that folder




--
Regards Ron de Bruin
http://www.rondebruin.nl


"TISR" wrote in message ...
Hi to all
I am trying to change the names of all the files in a folder by putting a
new month and year at the end of each file name using the following code:
Dim f as String, s as String
Const Dest = "C:\Mis documentos\12 December 2005\"
f = dir(Dest & "*.*")
do while f < ""
s = Mid(f, 1, (Len(f) - 9)) & _
Format(DateSerial(Year(Date), Month(Date) - 1, 1), "yyyy-mm")
Name Dest & f As Dest & s
f = dir()
Loop

It gets stuck in the following code:
Name Dest & f As Dest & s
Then I tried:
Name f As s
It Didnīt work. then I tried:
Name f As Dir(Dest & s)
It didnīt work
The message keeps on saying that it cannot find the root directory access.
Any solutions or ideas? It would be appreciated.
Regards
TISR