VBScript doesn't have a goto statement. Since your filename is being built based on time I would just loop while the file exists and then move on. In theory that shouldn't take more than a second.Code:Sub CreateOutputFileName Dim strFileName Do strError = "" strFileName = "NBS" & Month(now) & Day(now) & Year(now) & "-" & Hour(now) & Minute(now) & Second(now) & ".csv" strFileName = strOFolder & strFileName Loop While fso.FileExists(strFileName) Set tsi2 = fso.CreateTextFile(strFileName, 1) End Sub




Reply With Quote