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: Changing the Default Drive.
by Allen Wyatt
(last updated August 9, 2014)
Oftentimes it is helpful, in a macro, to specify which drive is considered the default drive. In other words, it may be helpful to indicate the drive on which all file operations should occur when you don't explicitly indicate a drive in a path name. To indicate the default drive to be used in a macro, you use the ChDrive statement, as follows:
This particular statement changes the current drive to E:. You can change to a different drive by simply changing the drive letter enclosed within the quote marks.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2541) 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: Changing the Default Drive.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
When creating macros, you often have to know how to display individual worksheets. VBA provides several ways you can display ...Discover More
Macros can be used to change the formatting of your worksheet, if desired. One change you might want to make is to the height ...Discover More
Do you get tired of the dialog box that says "do you want to enable macros" that is displayed when you open a workbook. You ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."