未分類

【VBA】日付を付けて保存を実行するエクセルマクロ

 

 

日付を付けて保存を実行

 VBA
Dim savdPath As String
savdPath = ThisWorkbook.Path
Dim buf As String
buf = Now & vbCrLf & Date & vbCrLf & Time
Dim smonth
Dim sday
smonth = Len(Month(Date))
sday = Len(Day(Date))
If smonth = 2 Then
smonth = Month (Date)
Else
smonth = "0" & Month(Date)
End If
If sday = 2 Then
sday = Day(Date)
Else
sday = "O" & Day (Date)
End If
ActiveWorkbook.SaveAs Filename: _
savdPath & "\" & Year(Date) & smonth & sday & "●●●.csv"
FileFormat:=x|CSV, CreateBackup:=False

 

 

-未分類

Copyright© grantish , 2025 All Rights Reserved.