Written by Allen Wyatt (last updated June 21, 2021)
This tip applies to Excel 97, 2000, 2002, and 2003
Your macros can rename a file by using the Name command. This is a holdover from other versions of BASIC. The syntax is:
Name OldFile As NewFile
where OldFile is the name of the old file, and NewFile is the name of the new file. Both filenames must either be string variables or be enclosed in quotes. Both filenames can contain complete path names, but both must be on the same disk drive. If the path names differ, then the command also has the side benefit of moving the file from one directory to another.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2364) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Renaming a File.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
Got a workbook that has lots and lots of macros associated with it? Here's a way you can get a list of all of those ...
Discover MoreNeed to hide some macros in your workbook? There are three ways you can do it, as covered in this discussion.
Discover MoreExcel allows you to assign shortcut keys to macros. Given two different workbooks each containing different macros, it is ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2017-02-23 04:07:08
Tana Vassou
Hi,
I have many excels in a Folder and want to rename them in a specific order. For example - Excel Sample A, Excel Sample B, Excel Sample C and so on.... Can you tell me the procedure to do this?
Thank you
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2023 Sharon Parq Associates, Inc.
Comments