Out of interest here is a function I played with to return as unique a
filename as I could work out. It worked but the name was sooooo long...
Function fncNumericDateTimeStamp(Optional spFormatString As Variant) _
As String
' Create DateTimeStamp.
' The FORMAT string may be passed.
' The Timer value and TIck count are always appended.
' The default returns a 27 character long string.
Dim slDTStamp As String
Dim llFTimer As Long
Dim llTimer As Long
Dim llITimer As Long
Dim slitimer As String
Dim slFTimer As String
Dim slTCount As String
Dim slFormatString
If IsMissing(spFormatString) Then
slFormatString = "yyyymmddhhnnss"
Else
slFormatString = spFormatString
End If
slTCount = CStr(GetTickCount())
llTimer = Timer()
llITimer = Int(llTimer)
slitimer = CStr(llITimer)
llFTimer = llTimer - llITimer
slFTimer = Mid(CStr(llFTimer), 2)
slDTStamp = Format(Now(), slFormatString)
slDTStamp = slDTStamp & slitimer & slFTimer & slTCount
' This loop ensures a different value
' from the last execution.
If slDTStamp = sgFileDateTimeStamp Then
For llTimer = 1 To 10000000
Next llTimer
slTCount = CStr(GetTickCount())
llTimer = Timer()
llITimer = Int(llTimer)
slitimer = CStr(llITimer)
llFTimer = llTimer - llITimer
slFTimer = Mid(CStr(llFTimer), 2)
slDTStamp = Format(Now(), slFormatString)
slDTStamp = slDTStamp & slitimer & slFTimer & slTCount
End If
sgFileDateTimeStamp = slDTStamp
fncNumericDateTimeStamp = slDTStamp
End Function