-
-
Save hedgejanuary/9122c3565626f3c138958df111353f0e to your computer and use it in GitHub Desktop.
Save file as .xlsx format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub Workbook_BeforeClose(Cancel As Boolean) | |
Dim fso As Object | |
Dim fName As String | |
Dim fPath As String | |
Set fso = CreateObject("Scripting.FileSystemObject") | |
Me.Worksheets(1).Cells("B4").Value = "Updated on " & Format(Now, "dd mmm yyyy") | |
'セルに表示形式を設定しておくなら日付のデータを入力するだけでいい。 | |
fName = fso.GetBaseName(Me.Name) | |
fPath = Me.Path | |
Application.DisplayAlerts = False | |
Me.SaveAs Filename:=fPath & "\" & Format(Now, "yymmdd") & "_" & fName, FileFormat:=xlWorkbookDefault | |
Application.DisplayAlerts = True | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment