Ay Dosto aaj main aap ko Excel ki file ko khatam yani sucide kerna sekatha hoo, hota yaoon hay kay baz dafa hum chaty hain kay ya version zyda dair na use ho ya is file ko user is date tak hi use ker saky tu ay start kerty hain.
Ms Excel open kerain.
ALT+F11 press kerain ya sheet tab per right click kerain aur view code select kerain.
left pain main this workbook per click kerain aur darj zail code paste ker dain
Public Sub da()
Dim Edate As Date
Edate = Format("09/04/2013", "DD/MM/YYYY") ' Replace this with the date you want
If Date > Edate Then
MsgBox ("This worksheet is not a final version and valid upto " & Format(Edate, "dd-mmm-yyyy") & " it will be closed, or deleted automatically.")
'ActiveWorkbook.Close
Call CommintSuicide
End If
If Edate - Date < 30 Then
MsgBox ("This worksheet expires on " & Format(Edate, "dd-mmm-yyyy") & " You have " & Edate - Date & " Days left ")
End If
End Sub
Public Sub CommintSuicide()
With ThisWorkbook
Application.DisplayAlerts = False
If .Path <> vbNullString Then
.ChangeFileAccess xlReadOnly
Kill .FullName
End If
ThisWorkbook.Close SaveChanges:=False
End With
End Sub
ab declaration main ja kay workbook per click kerain aur darj zail code lekhain.
Private Sub Workbook_Open()
Call da ' function ko call bhee tu kerna hay jab hum workbook open kerain
End Sub
ab excel ki file ko save kerain aur open kerain yadd rahy kay macro security medium honi chay aur enable macro ko click kerain jab file open ho warna ya kaam nahi kery ga, ab jab aap workbook ko open kerain gay tu agar tu wahi date ho gi tu message ay ga
"This workbook will expire on "09/04/2013" you have 0 date left"
ab agar date purani ho gi tu workbook nahi kuly gi aur message ay ga kay
"This worksheet is not a final version and valid upto 08/04/2013, it will be closed or deleted automatically"
jasy hi ok per click kerain gay workbook delete ho jay gi.
agar pasand ay tu comment zaroor dyna.
duaoon ka talab gar...(Ask me anything about MS Office).
.
Bookmarks