Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / October 2007

Tip: Looking for answers? Try searching our database.

Is it possible in Excel to have a file auto delete on a given dat.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Van - 08 Oct 2007 19:52 GMT
I'm trying to get an excel file to auto expire on a preset date. Does a
custom macro exist or can it be done with an Excel function?  Thank you
FSt1 - 08 Oct 2007 21:10 GMT
hi,
what do you mean by "auto expire"? what happens when it expires?

cautiously curious
FSt1

> I'm trying to get an excel file to auto expire on a preset date. Does a
> custom macro exist or can it be done with an Excel function?  Thank you
Sasa Stankovic - 08 Oct 2007 22:16 GMT
you mean like in movies... in 5 sec file will autodestroy?!?!?!?
5
4
3
2
1
bang!!!!!!

;-)

this or something similar?
really, you want file to be deleted from your hdd?

> hi,
> what do you mean by "auto expire"? what happens when it expires?
[quoted text clipped - 4 lines]
>> I'm trying to get an excel file to auto expire on a preset date. Does a
>> custom macro exist or can it be done with an Excel function?  Thank you
FSt1 - 08 Oct 2007 22:44 GMT
well.....
a macro can't delete the file it's in.
deleting the data in the file smacks of virus.
how about this.....
Private Sub Workbook_Open()
If Cells(2, 1) < Date Then
   MsgBox ("The data in this file has expired." & vbNewLine & _
       "Consult somebody about getting new data." & vbNewLine & _
       "Not responsibe for horribly bad things that happen" & vbNewLine & _
       "if decisions are made with this data.")
End If
End Sub

regards
FSt1

> you mean like in movies... in 5 sec file will autodestroy?!?!?!?
> 5
[quoted text clipped - 17 lines]
> >> I'm trying to get an excel file to auto expire on a preset date. Does a
> >> custom macro exist or can it be done with an Excel function?  Thank you
Gord Dibben - 09 Oct 2007 00:07 GMT
FSt1

Copy this to a new workbook.  Save the workbook.

Sub aaaa()
Application.DisplayAlerts = False
      ActiveWorkbook.ChangeFileAccess xlReadOnly
            Kill ActiveWorkbook.FullName
      ThisWorkbook.Close False
End Sub

See what happens when you run it.

The trick is to make the workbook readonly then it can commit suicide.

OP could run this from an ontime macro but I would suggest OP give ample warning
to the user of the workbook.

For more on OnTime see Chip Pearson's site.

http://www.cpearson.com/excel/OnTime.aspx

Gord Dibben  MS Excel MVP

>well.....
>a macro can't delete the file it's in.
[quoted text clipped - 33 lines]
>> >> I'm trying to get an excel file to auto expire on a preset date. Does a
>> >> custom macro exist or can it be done with an Excel function?  Thank you
Sasa Stankovic - 09 Oct 2007 20:53 GMT
hay everyone,
I was just joking in my last post... ;-)
I think that idea is really interesting. Actually, I don't think that anyone
has ever asked me something lke that.
And, how "safe" is to create such macro? What if user runs it and after 10
minutes wants everything back?
I don't see real use but solution is very elegant and nice.

sasa

> hi,
> what do you mean by "auto expire"? what happens when it expires?
[quoted text clipped - 4 lines]
>> I'm trying to get an excel file to auto expire on a preset date. Does a
>> custom macro exist or can it be done with an Excel function?  Thank you
Gord Dibben - 09 Oct 2007 21:50 GMT
Sasa

If user was to run the macro, the workbook is gone.

Does not go to recycle bin for recovery.

How safe and useful depends upon the developer who may want a payment after a
certain date and if payment not forthcoming, workbook is destroyed.

There are less drastic ways to disable a workbook functionality.

Gord

>hay everyone,
>I was just joking in my last post... ;-)
[quoted text clipped - 14 lines]
>>> I'm trying to get an excel file to auto expire on a preset date. Does a
>>> custom macro exist or can it be done with an Excel function?  Thank you
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.