![]() |
2 vba join together
how can i put the following 2 vba together, so when the workbook expire or over the limited, it will be deleted from the system? 1. Option Explicit Sub KillMe() With ThisWorkbook .Saved = True .ChangeFileAccess Mode:=xlReadOnly Kill .FullName .Close False End With End Sub 2. Private Sub Workbook_Open() Dim incRange As Range Dim StartDate As Date Set incRange = Range("Increment") StartDate = "19/06/06" 'Date delivered to customer Sheets("hidden").Visible = xlVeryHidden incRange = incRange + 1 Me.Save If incRange 10 Or Date - StartDate 14 Then Application.DisplayAlerts = False MsgBox "over the use limit, contact owner" Me.Close End If End Sub than -- jinvicto ----------------------------------------------------------------------- jinvictor's Profile: http://www.excelforum.com/member.php...fo&userid=3409 View this thread: http://www.excelforum.com/showthread.php?threadid=55398 |
2 vba join together
Private Sub Workbook_Open()
Dim incRange As Range Dim StartDate As Date Set incRange = Range("Increment") StartDate = "19/06/06" 'Date delivered to customer Sheets("hidden").Visible = xlVeryHidden incRange = incRange + 1 Me.Save If incRange 10 Or Date - StartDate 14 Then Saved = True ChangeFileAccess Mode:=xlReadOnly Kill Me.FullName Me.Close False End If End Sub but why not just acll KillMe in the IF statement? -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "jinvictor" wrote in message ... how can i put the following 2 vba together, so when the workbook expired or over the limited, it will be deleted from the system? 1. Option Explicit Sub KillMe() With ThisWorkbook Saved = True ChangeFileAccess Mode:=xlReadOnly Kill .FullName .Close False End With End Sub 2. Private Sub Workbook_Open() Dim incRange As Range Dim StartDate As Date Set incRange = Range("Increment") StartDate = "19/06/06" 'Date delivered to customer Sheets("hidden").Visible = xlVeryHidden incRange = incRange + 1 Me.Save If incRange 10 Or Date - StartDate 14 Then Application.DisplayAlerts = False MsgBox "over the use limit, contact owner" Me.Close End If End Sub thanx -- jinvictor ------------------------------------------------------------------------ jinvictor's Profile: http://www.excelforum.com/member.php...o&userid=34099 View this thread: http://www.excelforum.com/showthread...hreadid=553982 |
All times are GMT +1. The time now is 07:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com