Bluesguy07
New Member
- Joined
- Mar 11, 2016
- Messages
- 28
Hello all,
I am currently needing to add a "save as" function to add both the date, and hour to the filename. Currently, the script I have is below.
I want to add the Hour with an AM/PM or it could be in 24hr format. That portion doesn't matter to me. However, everything I try fails. The code above will save it in the proper folder, with the proper file name, and the proper date. I just need help in adding the time to it.
*NOTE* I have looked through the forum as I normally do. However, nothing I have found helps for this situation.
I am currently needing to add a "save as" function to add both the date, and hour to the filename. Currently, the script I have is below.
Code:
Sub SaveWorkbook()
Dim FilePath As String
Dim NewName As String
FilePath = "C:FILEPATH": NewName = FilePath & "Pack Labels" & Format(Date, "_MM-DD-YYYY") & ".xlsm"
ActiveWorkbook.SaveAs Filename:=NewName, FileFormat _
:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub
I want to add the Hour with an AM/PM or it could be in 24hr format. That portion doesn't matter to me. However, everything I try fails. The code above will save it in the proper folder, with the proper file name, and the proper date. I just need help in adding the time to it.
*NOTE* I have looked through the forum as I normally do. However, nothing I have found helps for this situation.
Last edited: