Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Bastet Massri   on Oct 03 In MS Office Category.

  
Question Answered By: Akins Massri   on Oct 03

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

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Wait function and Invisible function Or get search suggestion and latest updates.


Tagged: