Table of Content

Handy script to generate time stamp string.


Private Function LZ(ByVal Number)
'format to string of digital numbers

If Number < 10 Then
LZ = "0" & CStr(Number)
Else
LZ = CStr(Number)
End If
End Function

Private Function TimeStamp()
Dim CurrTime
CurrTime = Now()

TimeStamp = CStr(Year(CurrTime)) & "-" _
& LZ(Month(CurrTime)) & "-" _
& LZ(Day(CurrTime)) & "-" _
& LZ(Hour(CurrTime)) & "-" _
& LZ(Minute(CurrTime)) & "-" _
& LZ(Second(CurrTime))
End Function

Private Sub tstest()
MsgBox TimeStamp
End Sub