
Tips.Net > WordTips Home > Macros > Renaming a File
Summary: Need to rename a disk file from within a macro? You can do it using the Name command, described in this tip. (This tip works with Microsoft Word 97, Word 2000, Word 2002, Word 2003, and Word 2007.)
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 apparently moving the file from one directory to another.
Tip #3439 applies to Microsoft Word versions: 97 2000 2002 2003 2007
Tremendous Table Tips! We often take tables for granted, but Word includes some very powerful ways you can present your tabular data. Discover how to make your tables better, easier to understand, and more effective.
Check out WordTips: Terrific Tables today!
Add power to your purpose with Word. A comprehensive 480+ page e-book explains everything you need to know about macros. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Word2007 Tips
WordTips