Microsoft Knowledge Base |
|
XL5: Changing General Options Resets Current Directory |
|
|
Last reviewed: March 11, 1997
Article ID: Q125889 |
|
5.00 5.00c | 5.00 5.00a
WINDOWS MACINTOSHkbprg kbcode The information in this article applies to:
SYMPTOMSIf you create a Visual Basic, Applications Edition, macro that changes settings in the General tab (from the Tools Menu, choose Options, and select the General tab), the current directory and drive may be reset to the value specified in the Default File Location box of the General tab.
CAUSEVisual Basic for Applications commands similar to the following will cause the current directory to be reset to the value specified in the default file location of the General tab:
Application.ReferenceStyle = xlR1C1 Application.ReferenceStyle = xlA1 Application.DisplayRecentFiles = (logical) Application.DisplayExcel4Menus = (logical) Application.PromptForSummaryInfo = (logical) Application.ResetTipWizard Application.SheetsInNewWorkbook = 3 Application.StandardFont = "Arial" Application.StandardFontSize = "10" Application.DefaultFilePath = "C:\EXCEL" Application.AltStartupPath = "" Application.UserName = "Bill" WORKAROUNDTo work around this problem, save the setting for the current drive and directory in a variable before you use any of the above commands. You can then restore this setting as necessary.
Sample Visual Basic CodeMicrosoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.
Sub Save_CurrentDirectoryInfo() SaveDir = CurDir() 'Save the Current Directory Application.ResetTipWizard 'Update the Options Menu ChDrive (Left(savedir, 1)) 'Reinstate the Drive letter ChDir (savedir) 'Reinstate the Directory End Sub STATUSThis was corrected in Microsoft Excel for Windows 95, version 7.0.
|
|
KBCategory: kbprg kbcode
©1997 Microsoft Corporation. All rights reserved. Legal Notices. |