اذهب الي المحتوي
أوفيسنا

الردود الموصى بها

قام بنشر

السلام عليكم ورحمة الله وبركاته

هل بالامكان تغير الكود ليقوم بحفظ الملف باسم السنة الحالية والشهر السابق

ولكم الشكر والتقدير

 

 

 

Option Explicit
Sub SaveWithBackup()
Application.DisplayAlerts = False
With ThisWorkbook
.SaveCopyAs ThisWorkbook.Path & "\" & _
NameWithOutExt(.Name) & "
" & _
Format(Now, "
mmmm") & Format(Now, "yyyy") & ".xls"
.Save
End With
Application.DisplayAlerts = True
End Sub
Function NameWithOutExt(pStr_FileName As String)
Dim lStr_FileName As String
Dim lint_Pos As Integer
lStr_FileName = pStr_FileName
lint_Pos = InStr(1, lStr_FileName, "
.")
If lint_Pos > 0 Then lStr_FileName = Left _
(lStr_FileName, InStr(1, lStr_FileName, "
.") - 1)
NameWithOutExt = lStr_FileName
End Functio

 

قام بنشر
Sub SaveWithBackup()
Application.DisplayAlerts = False
With ThisWorkbook
.SaveCopyAs ThisWorkbook.Path & "\" & _
NameWithOutExt(.Name) & " " & _
Month(Now) - 1 & "-" & Format(Now, "yyyy") & ".xls"
.Save
End With
Application.DisplayAlerts = True
End Sub
Function NameWithOutExt(pStr_FileName As String)
Dim lStr_FileName As String
Dim lint_Pos As Integer
lStr_FileName = pStr_FileName
lint_Pos = InStr(1, lStr_FileName, ".")
If lint_Pos > 0 Then lStr_FileName = Left _
(lStr_FileName, InStr(1, lStr_FileName, ".") - 1)
NameWithOutExt = lStr_FileName
End Function
 

  • Like 1

انشئ حساب جديد او قم بتسجيل دخولك لتتمكن من اضافه تعليق جديد

يجب ان تكون عضوا لدينا لتتمكن من التعليق

انشئ حساب جديد

سجل حسابك الجديد لدينا في الموقع بمنتهي السهوله .

سجل حساب جديد

تسجيل دخول

هل تمتلك حساب بالفعل ؟ سجل دخولك من هنا.

سجل دخولك الان
×
×
  • اضف...

Important Information