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!
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!
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-
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
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!
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.
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
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.
as an option
just for testing change >= #1/30/2015# with the current date...
![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks