VBA or Macro

pooadrid

New Member
Joined
Nov 24, 2014
Messages
14
im attempting to create a workbook, that basically expires itself.

id like this to no be visable on the sheets it self, but when a pre determined time or date comes up, the workbook will erase all content throughout and save. essentially making the workbook useless.


is this possible?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi,

depending on the environment, it could be critical. Therfore just an idea:

- define a hidden name with the expire date
- in the workbook_open event compare with actual data

regards
 
Upvote 0
In rough in a macro enabled workbook

On workbook open event

If preset date less than today exit sub
If preset date greater or equal to Today()

Add new sheet

delete all sheets not equal to the new one you have just created

Activeworkbook.save

then close


Most of this can be recorded with macro recorder, and then tweaked
If you can make sure that you do not save too much code in modules or thisworkbook, then most of the code will be deleted as well
 
Upvote 0
I am not sure why you want to do this, but here is one thing to consider.

We have gotten requests like this before, sometimes from people who wanted to do this to programs that they created for their company (sort of a "job security" thing - so that if they were fired, there programs would stop working at some point). Just bear in mind that sort of thing is illegal in most places, and you could be opening yourself up to some legal issues if you do. So, if that is what your intention is, I would strongly advise against it.

If that is not what you need this for, then you can disregard all of what I just said!;)
 
Upvote 0

Forum statistics

Threads
1,215,044
Messages
6,122,827
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top