MakeUniqueFilename

Top  Previous  Next

function MakeUniqueFilename(sFileName As String) As String

 

Returns an unique filename by adding numbers to the filename specified in sFileName. The returned filename doesn't exist in the specified directory.

 

Parameters

 

sFileName ... String expression. Absolute path and filename.

 

Example:

Dim sFilename

 

sFilename = "e:\exp\main.txt"

 

' Assume that e:\exp\main.txt doesn't exist

sFilename = MakeUniqueFilename(sFilename)

' returns sFilename = "e:\exp\main.txt"

 

StringToFile(sFilename, "dummy")

sFilename = MakeUniqueFilename(sFilename)

' returns sFilename = "e:\exp\main(1).txt"




Translate document: