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?
 

Some videos you may like

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Fennek

Active Member
Joined
Nov 21, 2016
Messages
279
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
 

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
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
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,913
Office Version
  1. 365
Platform
  1. Windows
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!;)
 

Watch MrExcel Video

Forum statistics

Threads
1,122,335
Messages
5,595,573
Members
413,996
Latest member
mabelO

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
Top