Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default rename unknown named files

I have a bunch of different macros that are working at the moment the
only problem is that they will only work for a certain named file.

what I think would be the easiest way to make this work is to rename
the files in the folders.
these are the two folders which have the files I need to rename
C:\Documents and Settings\Owner\My Documents\Work\P123\dat
C:\Documents and Settings\Owner\My Documents\Work\P123\txt

Each folder would have 10 files in them at a time.


I would like to name them 1-10 dat and 1-10 txt if possible.

Any ideas???

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default rename unknown named files

Sub RenameFiles()
s1 = "C:\Documents and Settings\Owner\My Documents\Work\P123\dat\"
s2 = "C:\Documents and Settings\Owner\My Documents\Work\P123\txt\"
sName = dir(s1 & "*.*")
i = 0
do while sName < ""
i = i + 1
name s1 & sname as s1 & i & ".dat"
sName = dir()
Loop

sName = dir(s2 & "*.*")
i = 0
do while sName < ""
i = i + 1
name s2 & sname as s2 & i & ".txt"
sName = dir()
Loop

End Sub

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
I have a bunch of different macros that are working at the moment the
only problem is that they will only work for a certain named file.

what I think would be the easiest way to make this work is to rename
the files in the folders.
these are the two folders which have the files I need to rename
C:\Documents and Settings\Owner\My Documents\Work\P123\dat
C:\Documents and Settings\Owner\My Documents\Work\P123\txt

Each folder would have 10 files in them at a time.


I would like to name them 1-10 dat and 1-10 txt if possible.

Any ideas???



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default rename unknown named files

Amazing!!!!!!!!!!!
Thank you sooooo very much
Now what would I need to change if I wanted to use the same thing to
20,30 or more files?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default rename unknown named files

nothing as long as they are named in numerical sequence from 1 to N

--
Regards,
Tom Ogilvy


wrote in message
ups.com...
Amazing!!!!!!!!!!!
Thank you sooooo very much
Now what would I need to change if I wanted to use the same thing to
20,30 or more files?



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
Unknown excel backup files created in network directory Mike Excel Discussion (Misc queries) 0 September 18th 07 01:26 PM
Help to rename files Hilton Excel Worksheet Functions 7 July 7th 07 03:51 AM
Macro to add cells from unknown number of files rich.s Excel Programming 0 August 4th 05 03:39 PM
Rename Files Dominique Feteau Excel Programming 1 July 13th 04 11:19 PM
FTP Accessing remote files where filenames are unknown GeeBee Excel Programming 4 May 5th 04 06:03 PM


All times are GMT +1. The time now is 03:06 AM.

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"