29/05/2024, 10:12
atoykan
Winrar ile yedekleme için kodunuzu aşağıdaki gibi revize edin
Private Sub Komut0_Click()
Dim Yer As String, KlasorVarmi As String, WinRARPath As String, ShellStr As String
KlasorVarmi = "D:\Test-1"
If Len(Dir(KlasorVarmi, vbDirectory)) = 0 Then MkDir (KlasorVarmi)
Yer = "D:\Test-1\Sakarya\ÇALIŞMA"
If Len(Dir(Yer, vbDirectory)) = 0 Then MkDir (Yer)
Dim SourceFile As String, TargetFile As String
SourceFile = "D:\Test-2\Deneme.accdb"
TargetFile = Yer & "\Deneme.accdb"
FileCopy SourceFile, TargetFile
WinRARPath = """C:\Program Files\WinRAR\WinRAR.exe"""
ShellStr = WinRARPath & " a -r " & Yer & "\Deneme.rar " & TargetFile
Shell "cmd /c " & ShellStr, vbHide
End Sub