Good morning everyone,
I'd like to make my code to check if a file with same name is in the folder already, if so, make it to save with a different number index starting with 1. Here is the code that I'm using now:
Can anybody please help me?
I'd like to make my code to check if a file with same name is in the folder already, if so, make it to save with a different number index starting with 1. Here is the code that I'm using now:
VBA Code:
Sub TestFile
Dim FilePathandName As String
Set fs = CreateObject("scripting.filesystemobject")
FilePathandName = Application.ActiveWorkbook.FullName
Set file = fs.CreateTextFile(Mid(FilePathandName, 1, InStrRev(FilePathandName, ".") - 1) & ".kml", True, True)
End Sub
Can anybody please help me?