+ Reply to Thread
Results 1 to 3 of 3

Not able to self delete the excel

  1. #1
    Registered User
    Join Date
    02-17-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    48

    Cool Not able to self delete the excel

    Hi,

    I wanted to self delete the excel - vba project when pressed on exit button. It doesn't self delete the excel instead it gives me permission denied error(error1.jpg) also find the code for the self deleting the excel.

    Please Login or Register  to view this content.
    Just few background why iam trying to self delete the same excel, first time user will be opening the excel - vba project from a site and using it. When user open it from the site second time it prompt that the excel is read-only and that's because of the duplicate file lying in temp folder. When they open it readonly and run the project it gives a runtime error, but if they download it to desktop and use it it doesn't give any error.
    In order to delete the file at first time they open and after using it.

    Please let me know how to solve this problem. Please Help!
    Last edited by harry_1805; 03-19-2012 at 06:02 AM. Reason: Solved

  2. #2
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: Not able to self delete the excel

    Are you trying to delete the file in which the code resides? If the file is currently open on the host machine, then you need to make sure it is Read-Only otherwise you will get an error returned. You can do this via:

    Please Login or Register  to view this content.
    If you are trying to kill the workbook in which the code is running then you should change your ActiveWorkbook references to ThisWorkbook to avoid the risk of deleting an incorrect file.

  3. #3
    Registered User
    Join Date
    02-17-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    48

    Cool Re: Not able to self delete the excel

    This i tired here also i got error because file was in Temporary Internet Folder and was not changing status to readonly. Instead what I did was clear temporary internal folder with VBA command while on exit. This solved the actual problem I had.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1