اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

تعديل كود


jawad80

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

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

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

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

 

 

 

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
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • اضف...

Important Information