ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Kill file (https://www.excelbanter.com/excel-programming/371644-kill-file.html)

ew

Kill file
 
I have an excel worksheet that I want to delete itself on a certain date. Is
there a code that I use to accomplish this?

Thanks for any help in the matter!


[email protected]

Kill file
 

EW wrote:
I have an excel worksheet that I want to delete itself on a certain date. Is
there a code that I use to accomplish this?

Thanks for any help in the matter!


Hi,

Try using the application.ontime method .. Check the help file for
additional info.

HTH,
Tausif


AA2e72E

Kill file
 
I don't believe this is possible. For the workbook to delete itself, it has
to contain the code to do so: any attempt to delete the workbook will fail
since the workbook will be open at the time and if you close the workbook,
you lose the running code.

[email protected]

Kill file
 
Hi Tausif,

you can do that by Timer ... rather than application.ontime
But there will be a timer running each time you open XL.
that timer could be harmed your XL in wrong operation.

Sure that timer should be use correctly.

Rgds,

Halim

menuliskan:
EW wrote:
I have an excel worksheet that I want to delete itself on a certain date. Is
there a code that I use to accomplish this?

Thanks for any help in the matter!


Hi,

Try using the application.ontime method .. Check the help file for
additional info.

HTH,
Tausif



ward376

Kill file
 
In the ThisWorkbook module try...

Option Explicit
Dim Expiry As Long

Private Sub Workbook_Open()
Expiry = 38958 'serial number for date 8/29/6
If Date = Expiry Then
MsgBox "This workbook has expired." 'warning optional
With ThisWorkbook
.Save
.ChangeFileAccess Mode:=xlReadOnly
Kill .FullName
.Close SaveChanges:=False
End With
End If
End Sub



All times are GMT +1. The time now is 03:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com