XL: Changing from One Drive to Another Recorded Incorrectly

Last reviewed: September 13, 1996
Article ID: Q119489
The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for Windows 95, version 7.0

SYMPTOMS

When you are recording a Visual Basic, Applications Edition, macro and you choose Open or Save As from the File menu and change the active drive, the macro recorder may incorrectly record the drive change as a directory change. When the macro is replayed, it produces an error message:

   Run-time error '1004':
   Cannot find '<filename>':

WORKAROUND

To work around this problem, you must edit the macro. Select the module sheet in which the macro was recorded and change the following macro code

   ChDir "<drive letter>:\"

to:

   ChDrive "<drive letter>:\"

Microsoft provides examples of Visual Basic 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. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose.

STATUS

Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

REFERENCES

For more information about the ChDrive and ChDir statements, choose the Search button in Visual Basic Help and type:

   chdrive

or:

   chdir


KBCategory: kbprg
KBSubcategory:

Additional reference words: 5.00 5.00c 7.00 switch network floppy path



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 13, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.