bottom
Great ExcelTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > ExcelTips Home > Macros > Changing the Default Drive

Changing the Default Drive

Summary: Macros often need to work on various files on your disk drive in order to process data in a worksheet. You can specify the drive that your macro should use as “default” by using the command described in this tip. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)

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:

ChDrive "E"

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.

Tip #2541 applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003 | 2007


Got the Time? If you work with either times or dates in Excel, you really need ExcelTips: Times and Dates. Everything you need to know about slicing, dicing, and generally working with times and dates.

Helpful Links

Ask an Excel Question
Make a Comment

Tips.Net Home
Vital News Home

ExcelTips FAQ
ExcelTips Premium

Learn Access Now

Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips

Advertise on the
ExcelTips Site

 

Great Info!

Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)