I am looking for VBA to add to my macro that will increment the file name if the file name already exists.
Current Code:
Dim filepath As String Dim
Someone suggested this and it worked for me:
Dim filecount As Integer Do While Len(Dir(filepatharch & thfilename)) <> 0 filecount = filecount + 1 filedate = Format(Now, "MMDD0" & filecount & ".") tdfilename = "TD" & filedate & filelist thfilename = "TH" & filedate & filelist Loop