Public Sub CreateNextFileName()
Dim Workbook1 As Workbook
Dim I As Integer
Dim FileName As String
Set Workbook1 = Workbooks.Add(Template:=ThisWorkbook.Path & "\Temp.xls")
I = 0
Do
I = I + 1
FileName = ThisWorkbook.Path & "\Temp" & I & ".xls"
Loop While FileExists(FileName)
Workbook1.SaveAs FileName:=FileName
End Sub
|