Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Global Save As?

Assuming that all files are in the same folder, and that the folder doesn't
contain files that you don't want to rename, use code like the following:

Sub RenameAll()

Const C_FOLDER_NAME = "C:\Test" '<<<< CHANGE THIS
Const C_WORD_TO_APPEND = "Test" '<<<< CHANGE THIS
Dim FName As String
Dim NewName As String
Dim Pos As Integer
ChDrive C_FOLDER_NAME
ChDir C_FOLDER_NAME
FName = Dir("*.xls") ' Change the *.xls to whatever file spec you need.
Do Until FName = vbNullString
Pos = InStrRev(FName, ".")
NewName = Left(FName, Pos - 1) & C_WORD_TO_APPEND & Mid(FName, Pos)
Name FName As NewName
FName = Dir()
Loop

End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Jane" wrote in message
...
We need to change the file names of 65 files by adding the same 1 word to
the
beginning of each file name.

Is it possible to do a global save as so we do not have to re-name each
file?

thank you in advance! jane



 
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
Global macros Ken Excel Discussion (Misc queries) 3 January 5th 07 11:21 PM
Global changes to links Jo Charts and Charting in Excel 2 April 15th 05 05:37 AM
Charts and "global" changes AlCamp Charts and Charting in Excel 3 March 28th 05 05:33 AM
Global Function T.R. Excel Discussion (Misc queries) 1 February 16th 05 07:03 PM
Global Group Denise S Excel Worksheet Functions 5 January 31st 05 01:42 AM


All times are GMT +1. The time now is 01:44 PM.

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"