LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Change excel file name by macro

Sorry, my Excel was down last night.

Try this

Filename = Dir("C:\My Documents\Forms\*.xls")
Do While Filename < ""

NewName = Right(Filename, Len(Filename) - InStr(Filename, "-") - 1)
Name Filename As NewName

Filename = Dir
Loop


--
__________________________________
HTH

Bob

"K" wrote in message
...
On Feb 3, 9:44 am, "Bob Phillips" wrote:
Filename = Dir("C:\My Documents\Forms\*.xls"
Do While Filename < ""

NewName = Right(Filename, Len(Filename) - Instr(Filename, "-") - 1)
Name Filename, NewName

Filename = Dir
Loop

--
__________________________________
HTH

Bob

"K" wrote in message

...



Hi all, I have excel files with names (see below) in folder "C:\My
Documents\Forms".


PERMANENT TRANSFER FORM (BT) - 552360.xlsm
PERMANENT TRANSFER FORM (BT) - 512360.xlsm
PERMANENT TRANSFER FORM (BT) - 556360 - PG 1.xlsm
PERMANENT TRANSFER FORM (BT) - 556360 - PG 2.xlsm
PERMANENT FAQS FORM (BT) - 546660 - 546661.xlsm
PERMANENT REQ FORM (BT) - 598774 - 598775.xlsm


I want macro on a button which should shorten the name something like
(see below) of all the files in the folder.


552360.xlsm
512360.xlsm
556360 - PG 1.xlsm
556360 - PG 2.xlsm
546660 - 546661.xlsm
598774 - 598775.xlsm


Please can any friend can help.- Hide quoted text -


- Show quoted text -


thanks for replying Bob. i am getting error on line Name Filename,
NewName. please can you tell me what i am doing wrong




 
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
Macro to change file properties TomH Excel Programming 1 July 2nd 08 04:52 PM
Macro speed change when closing file snax500 Excel Programming 3 June 30th 08 07:09 PM
macro to change tab name to file name jeremy nickels Excel Programming 5 November 13th 07 05:18 AM
Macro to change sign on text file imported to Excel BC Excel Programming 4 July 27th 07 03:06 PM
Change Code in Macro to specify file/folder to look in. Dtown Dawg Excel Programming 1 July 14th 06 06:34 PM


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