incsoft
Altın Üye
- Katılım
- 18 Ağustos 2009
- Mesajlar
- 739
- Excel Vers. ve Dili
- Office Ev ve İş 2021 - Türkçe
- Altın Üyelik Bitiş Tarihi
- 12-12-2024
Arkadaşlar aşağıdaki macro ile dosyam 20 dk kullanılmadığından kaydederek otomatik kapatmasını sağlıyorum. Buraya 2.bir koşul koyabilirmiyiz? Mesela sadece şu ıp numaralı bilgisayarda dikkat alma tüm hepsinde al ya da bilgisayar adı bu olanı dikkate alma gibisinden.
Option Explicit
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
ResetTimer
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Not IsEmpty(CloseDownTime) Then
Application.OnTime EarliestTime:=CloseDownTime, Procedure:="CloseDownFile", Schedule:=False
End If
End Sub
Option Explicit
Public CloseDownTime As Variant
Public Sub ResetTimer()
On Error Resume Next
If Not IsEmpty(CloseDownTime) Then Application.OnTime EarliestTime:=CloseDownTime, Procedure:="CloseDownFile", Schedule:=False
CloseDownTime = Now + TimeValue("00:20:00") hh:mm:ss
Application.OnTime CloseDownTime, "CloseDownFile"
End Sub
Public Sub CloseDownFile()
On Error Resume Next
Application.StatusBar = "Inactive File Closed: " & ThisWorkbook.Name
ThisWorkbook.Close SaveChanges:=True
End Sub
Option Explicit
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
ResetTimer
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Not IsEmpty(CloseDownTime) Then
Application.OnTime EarliestTime:=CloseDownTime, Procedure:="CloseDownFile", Schedule:=False
End If
End Sub
Option Explicit
Public CloseDownTime As Variant
Public Sub ResetTimer()
On Error Resume Next
If Not IsEmpty(CloseDownTime) Then Application.OnTime EarliestTime:=CloseDownTime, Procedure:="CloseDownFile", Schedule:=False
CloseDownTime = Now + TimeValue("00:20:00") hh:mm:ss
Application.OnTime CloseDownTime, "CloseDownFile"
End Sub
Public Sub CloseDownFile()
On Error Resume Next
Application.StatusBar = "Inactive File Closed: " & ThisWorkbook.Name
ThisWorkbook.Close SaveChanges:=True
End Sub