+ Reply to Thread
Results 1 to 5 of 5

Deleting excel file on Occurrence of a particular date

  1. #1
    Forum Contributor
    Join Date
    03-03-2004
    Location
    mumbai
    MS-Off Ver
    2003,2007
    Posts
    151

    Deleting excel file on Occurrence of a particular date

    Hi all,

    I need a feature which will delete an excel file on occurence of a particular date.

    For example: If i would like to delete an excel file after 27th of july 2010, the moment i open excel file after 27th of july 2010 the file should get deleted.
    thank you

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Deleting excel file on Occurrence of a particular date

    Windows won't let you delete a file which is open and you can't close the file to delete it, but have the delete macro continue to run, so you'd have to open a new workbook, pass control to a macro in that book and have it close and delete the calling workbook.

    Alternatively you could save the original workbook under a different name and then delete the original, although, of course, that would still leave you with a copy of the workbook.

    Or you could have a master workbook which parses through a directory structure, opens all of the workbooks it finds, checks to see if they should be deleted and then closes and deletes them.

    If you're writing a macro which is going to delete things then be very, very sure to make a backup of pretty much everything, otherwise you're almost certainly going to lose data,

  3. #3
    Forum Contributor
    Join Date
    03-03-2004
    Location
    mumbai
    MS-Off Ver
    2003,2007
    Posts
    151

    Re: Deleting excel file on Occurrence of a particular date

    Hi Andrew thanks.
    I am ok even if all the sheets can be deleted.
    Can you please help me with that?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Deleting excel file on Occurrence of a particular date

    Please Login or Register  to view this content.
    Of course, you have to force the user to enable macros, which is covered in many examples in the forum.
    Last edited by shg; 07-23-2010 at 07:04 AM.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Contributor
    Join Date
    03-03-2004
    Location
    mumbai
    MS-Off Ver
    2003,2007
    Posts
    151

    Re: Deleting excel file on Occurrence of a particular date

    Thanks Shg for your help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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