+ Reply to Thread
Results 1 to 4 of 4

Macro to delete excel file on opening

  1. #1
    Registered User
    Join Date
    01-08-2014
    Location
    wigan
    MS-Off Ver
    2007
    Posts
    78

    Macro to delete excel file on opening

    Hi, I wish to protect one of my designs so that a workbook will not open after a trial period has expired, or even better will delete itself completely after a particular date.

    Is there any way to do this?

    thanks.
    dan.

  2. #2
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Re: Macro to delete excel file on opening

    Hi Dan

    Personally, I would say this method is a bad idea as a user can hold shift on load which stops any macros from running.
    If you really want someone to try something, I'd do it a different way (perhaps a reduced version?)

    But as you asked - the attached should do what you need.

    If the date in A1 is less than todays date, it is deleted. You can also change the code to a specific date.
    delete book.xlsm

  3. #3
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: Macro to delete excel file on opening

    use this
    Please Login or Register  to view this content.
    there should be one sheet after delete in the workbook
    Last edited by Kamboj; 11-04-2014 at 01:35 AM.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro to delete excel file on opening

    Hi, Kamboj,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7).

    Ciao,
    Hiolger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Activate VB Macro when opening excel file
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-21-2012, 01:35 PM
  2. Macro/VBA needed for opening excel file
    By tcw1986 in forum Excel Programming / VBA / Macros
    Replies: 35
    Last Post: 01-16-2012, 05:08 AM
  3. Delete Excel sheet without opening file
    By ena_george in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-17-2009, 07:24 PM
  4. Replies: 1
    Last Post: 06-04-2007, 10:21 AM
  5. Macro available when opening new excel file
    By skrimpy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-19-2005, 08:07 AM

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