Self deleting/destructing excel file

bhaveshk

New Member
Joined
Jul 9, 2008
Messages
2
Guys,
I have been breaking my head over creating a excel file which deletes its content OR clears its content after expiry of certain time.
The whole idea is to bascially render the excel file useless beyong a time.
Ways of rendering it useless
1. value paste (so that no one knows hows values were calculated)
2. Delete content in each cell of every worksheet

I am a rookie at VB, so please guide accordingly...

BK
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi
paste the following codes in the macro window ( Alt F11 Insert > module)
Code:
Sub auto_open()
If Now() > Worksheets("sheet1").Cells(1, 1) Then
MsgBox "overdue"
For a = 1 To Sheets.Count
Worksheets(a).Cells.ClearContents
Next a
else
Msgbox "Not yet due"
End If
End Sub
Set the expiry date in A1 of sheet1 . Whenever you open the file, macro should run and gives appropriate message.
Ravi
 
Upvote 0
Hey Ravi,

Thanks a ton man. it worked just fine. I cannot thank you enough.
Your code has inspired me to learn VB in detail now. If you have any ebook on VB do send it to me on bhaveshk at sharekhan dot com.
 
Upvote 0
self deleting excell file after 3 openings of file

Dear Friends

kindly help me to making a excell file, which expires after no of openings i.e 2 or 3 tiems files opens and macros message should not be appears and automatically macros should opens
 
Upvote 0
Hi
try these codes
Code:
Sub auto_open()
Cells(1, 26) = Cells(1, 26) + 1
If Cells(1, 26) = 3 Then
MsgBox "Workbook Expired. Contact Author"
Cells(1, 26) = 2
ActiveWorkbook.Close True
End If
End Sub
you can open the book 2 times. third time, it gives a message and closes the book. try it with a sample file before you use it somewhere.
Ravi
 
Upvote 0
Mr Ravi,

Thanks for your code, it realy working good, but i have some another problem with in,
that, if any body disable macros, the code won't work, so the code has to be run automatically enabling the macros in the sheet.


Thanking you, for your code.

cnu nagula
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,208
Members
448,554
Latest member
Gleisner2

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