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.
With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company.
Learn more about Allen...
Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Removing a Directory.
In other issues of ExcelTips you learn how to create a directory from within a macro. There are times that programmers (even macro programmers) create directories to store temporary files. When they are done, the files are deleted and the directory is removed. To remove a directory, you use the RmDir command in your macro, as shown here:
where DirName is the full pathname of the directory you want to delete. If you do not use a string variable to specify the directory name, then DirName must be enclosed in quotes. If there are any files in the directory or any subdirectories contained in the subdirectory, the command fails with an error. (This means you should delete all the files and subdirectories before trying to remove a directory with RmDir.)
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2441) 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: Removing a Directory.
More Power! For some people, the prospect of creating macros can be scary. Those who conquer their fears, however, find they become much more confident and productive once they learn how to make Excel do exactly what they want. ExcelTips: The Macros is an invaluable source for learning Excel macros. You are introduced to the topic in bite-sized chunks, pulled from past issues of ExcelTips. Learn at your own pace, exactly the way you want. Check out ExcelTips: The Macros today!