Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/105211

From BetaArchive Wiki

Microsoft Knowledge Base

MXL: Can't Delete Folder Using Macro or Procedure

Last reviewed: September 12, 1996
Article ID: Q105211

The information in this article applies to:

  • Microsoft Excel for the Macintosh, versions 3.0, 4.0, 5.0

SYMPTOMS

In Microsoft Excel version 5.0, when you use the RmDir statement in a Visual Basic procedure, you may receive the following error message:

   Run-time error '75':

   Path/File access error

In Microsoft Excel, when you use DELETE.DIRECTORY() in a macro, the command may return the logical value FALSE and fail to delete the specified folder.

Additionally, when you drag a folder to the trash in the Finder while Microsoft Excel is running, you may receive the following error message when you empty the trash

   The item "<foldername>" could not be deleted, because it contains items
   that are in use. Do you want to continue?

Where <foldername> is the name of the folder that you are trying to delete.

CAUSES

This behavior may occur if any of the following are true:

  • The folder is not empty.
  • The folder is the current folder in Microsoft Excel (the default folder that appears when you choose Open from the File menu).
  • The folder name or path to the folder is not properly specified in the RmDir statement, or the DELETE.DIRECTORY() macro command.
  • Microsoft Excel has created a "working directory" for the folder. A working directory is an internal name that points to the folder and prevents the folder from being deleted using the RmDir statement or the DELETE.DIRECTORY() command or the Finder until you quit Microsoft Excel. A working directory to the folder can be created if one of the following occurs during the current session of Microsoft Excel:

          A file is manually opened, deleted, or saved to the folder.
          -or-
          A file is opened or saved to the folder via a macro.
          -or-
          The the DIRECTORY() command is used to make the folder current; even
          if the folder is no longer the current folder, a working directory to
          the folder is created.
          -or-
          The DELETE.DIRECTORY() command failed previously because the
          folder was current. Even if you manually change to a different
          folder, the DELETE.DIRECTORY() command will still fail.

WORKAROUNDS

To prevent a working directory from being created, do not use the ChDir statement, or the DIRECTORY() command to change to the folder. If you need to delete files from the folder, specify the path to the folder in the Kill statement, or the FILE.DELETE() command.

If a working directory has been created due to one of the causes stated previously, you must quit Microsoft Excel before you can delete the folder.

Note if you delete a file in Microsoft Excel version 5.0 using the Find File dialog box, a working directory is not created, and this behavior does not occur.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


KBCategory: kbusage

KBSubcategory: xlmac

Additional reference words: 3.00 4.00 5.00 remove



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 12, 1996
©1997 Microsoft Corporation. All rights reserved. Legal Notices.