mcetinkaya65
Altın Üye
- Katılım
- 1 Mart 2011
- Mesajlar
- 487
- Excel Vers. ve Dili
- 2021 türkçe
- Altın Üyelik Bitiş Tarihi
- 24-12-2030
Aşağıdaki makro ile dosyamı kapatınca bilgisayarın d diskinde yedekler klasöründe yedek oluşturuyor.Çok güzel.Ama o klasör zamanla çok şişiyor.Biz bunu 7 günle sınırlasak.Mümkün mü acaba?Yani 7 günlük yedek alsa 8 . gün yedeklemek isteyince, 1. günün yedeğini silse.
Saygılarımla..
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set ds = CreateObject("Scripting.FileSystemObject")
ThisWorkbook.Save
If ds.FolderExists("D:\YEDEKLER") = False Then
ds.CreateFolder "D:\YEDEKLER"
End If
If ThisWorkbook.Path = "D:\YEDEKLER" Then Exit Sub
If MsgBox("Dosyanın yedeğini almak istiyor musunuz?", vbInformation + vbYesNo, "DURUM") = vbYes Then
yol = "D:\YEDEKLER\" & Replace(Now, ":", "_") & "-" & ThisWorkbook.Name
ds.CopyFile ThisWorkbook.FullName, yol
End If
End Sub
Saygılarımla..
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set ds = CreateObject("Scripting.FileSystemObject")
ThisWorkbook.Save
If ds.FolderExists("D:\YEDEKLER") = False Then
ds.CreateFolder "D:\YEDEKLER"
End If
If ThisWorkbook.Path = "D:\YEDEKLER" Then Exit Sub
If MsgBox("Dosyanın yedeğini almak istiyor musunuz?", vbInformation + vbYesNo, "DURUM") = vbYes Then
yol = "D:\YEDEKLER\" & Replace(Now, ":", "_") & "-" & ThisWorkbook.Name
ds.CopyFile ThisWorkbook.FullName, yol
End If
End Sub