+ Reply to Thread
Results 1 to 8 of 8

Kill command/ Time bomb/ permanently delete

  1. #1
    Registered User
    Join Date
    09-04-2014
    Location
    Thailand
    MS-Off Ver
    2013
    Posts
    16

    Kill command/ Time bomb/ permanently delete

    Hi,

    I'm wanting to set a kill command for a file. The file is in Location:

    C:\Users\Thomas Hindle\Desktop\Tracker.xlsm

    I'm wanting it to expire at the end of April 2014. (30/04/15)

    Thanks in advance for any help anyone can give.

    Cheers!

  2. #2
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,062

    Re: Kill command/ Time bomb/ permanently delete

    Hi Thomas,
    make a copy of yr file and you can try this to see if it helps you
    Please Login or Register  to view this content.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

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

    Re: Kill command/ Time bomb/ permanently delete

    Hi, John,

    with a date like 30.04.2014 you will always kill the file - shouldn´t it be next year (2015) from the logic (or 180 days from the first opening). And using a MsgBox and giving the user a choice will underrun the efforts to "kill" the file if the user chooses no.

    Ciao,
    Holger
    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

  4. #4
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,062

    Re: Kill command/ Time bomb/ permanently delete

    Hi Holger,
    You're right, but it was just an example, this is the reason of red color, the user needs to change the date as he wants, the reason of msgbox is...well, perhaps it should be removed!
    Thx!

  5. #5
    Registered User
    Join Date
    09-04-2014
    Location
    Thailand
    MS-Off Ver
    2013
    Posts
    16

    Re: Kill command/ Time bomb/ permanently delete

    Hi guys,

    Thanks for the reply's, and cheers to John55 for the macro! it works perfectly for what I need with one or two minor tweaks.

    Entered into the, 'This Workbook' area of the VBA.


    Private Sub Workbook_Open()
    If Date >= #1/30/2015# Then
    ThisWorkbook.Saved = True
    If MsgBox("This Tracker is due to expire in 3 months, please contact the developer before the 04/30/15 to ensure no data loss") = vbOK Then
    End If
    End If

    If Date >= #4/30/2015# Then
    ThisWorkbook.Saved = True
    If MsgBox("This Tracker has expired and will be deleted, please contact the developer to continue with this product. You will be able to view a temporary Read-only copy of your Tracker. Thank you for your purchase") = vbOK Then
    ThisWorkbook.ChangeFileAccess xlReadOnly
    Kill ThisWorkbook.FullName
    End If
    End If
    Last edited by ThomasAnthony; 11-05-2014 at 11:52 PM.

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

    Re: Kill command/ Time bomb/ permanently delete

    Hi, ThomasAnthony,

    when displaying code here on ExcelForum please use code-tags (not quote-tags ).

    You should revert the two conditions as I think any user would be irritated to first see a message about the expiration and then immediately find a message about destruction. And there will be no read-only version of the workbook as it is said in the message, at least not with the bit of code displayed here.

    Ciao,
    Holger

  7. #7
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,062

    Re: Kill command/ Time bomb/ permanently delete

    Holger is right, the first msg can be replaced by a notice, a label, a userform with this info and the code itself for destruction afretr your specified date.

  8. #8
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,062

    Re: Kill command/ Time bomb/ permanently delete

    as an option
    just for testing change >= #1/30/2015# with the current date...
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. Time bomb not working
    By go2review in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2014, 12:24 AM
  2. Kill the cmd window after shell command
    By ljoseph in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2012, 07:14 PM
  3. How to permanently halt/kill a running calc/reformat?
    By kobayashi_maru in forum Excel General
    Replies: 5
    Last Post: 07-26-2012, 06:00 PM
  4. Setting a time kill/delete by set date in spreadsheet
    By exempt in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-17-2011, 09:56 PM
  5. Kill command using &
    By PCLIVE in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-01-2006, 03:40 PM

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