Try
If IO.Directory.Exists("C:\النسخة الإحتياطية لمشروع الدوام\ABDELAZIZ.dll") = False Then
IO.Directory.CreateDirectory("C:\النسخة الإحتياطية لمشروع الدوام")
End If
If IO.File.Exists("C:\النسخة الإحتياطية لمشروع الدوام\ABDELAZIZ.dll") Then
If MsgBox("الملف الحالي" & vbCrLf & Application.StartupPath & "\ABDELAZIZ.dll" & vbCrLf & "الملف الجديد" & vbCrLf & "C:\النسخة الإحتياطية لمشروع الإمتحانات الفصليّة\ABDELAZIZ.dll" & vbCrLf & "هل تريد استبدال الملف الحالي بالجديد ؟", MsgBoxStyle.Exclamation + MsgBoxStyle.MsgBoxRight + MsgBoxStyle.OkCancel, " نسخ ملف") = MsgBoxResult.Cancel Then Exit Sub
End If
If IO.File.Exists(Application.StartupPath & "\Compact_ABDELAZIZ.mdb") Then
IO.File.Delete(Application.StartupPath & "\Compact_ABDELAZIZ.mdb")
End If
Dim Engine
Engine = CreateObject("JRO.JetEngine")
Engine.CompactDatabase("provider=microsoft.Jet.oledb.4.0;data source=" & Application.StartupPath & "\ABDELAZIZ.dll",
"provider=microsoft.Jet.oledb.4.0;data source=" & Application.StartupPath & "\Compact_ABDELAZIZ.dll")
Dim DBFilename, NewFileName As String
DBFilename = Application.StartupPath & "\Compact_ABDELAZIZ.dll"
'NewFileName = "C:\النسخة الإحتياطية \DOUSSA.mdb"