Generates new available file name for a certain file in order to duplicate it, this does not duplicate the file, it just generate name for it, making sure new file name does not exist using Dir command.
No change if sFileName file was not found, allowing to use this empty slot.
Sepa2 is the separator between filename and numeric counter after it, default to space
Access is limited.
Login here using your Linkedin account. to see or download code.
No registration, not another password to remember, login using your Linkedin account and have access to all public codes in Mydevlib.com
Linkedin LoginsFileName, Sepa2
' ' Demonstration routine
' ' Sub Test()
' ' Dim sFileName As String, sUniqueFileName As String
' ' sFileName = "C:\Filename.xls"
' ' sUniqueFileName = DuplicateFilename(sFileName, "")
' ' MsgBox "The unique file name is " & sUniqueFileName
' ' End Sub
' ' Sub Test()
' ' Dim sFileName As String, sUniqueFileName As String
' ' sFileName = "C:\Filename.xls"
' ' sUniqueFileName = DuplicateFilename(sFileName, "")
' ' MsgBox "The unique file name is " & sUniqueFileName
' ' End Sub
Views 4,631
Downloads 1,428
CodeID
DB ID